On Fri, Jul 10, 2009 at 1:00 PM, Daniel Lyons<fus...@storytotell.org> wrote: > > > On Jul 10, 2009, at 12:24 PM, Sean Devlin wrote: > >> >> A quick java program: >> >> public static void main(String[] args) { >> System.out.println(1.0/0.0); >> } >> >> Infinity >> >> >> On Jul 10, 11:08 am, John Harrop <jharrop...@gmail.com> wrote: >>> This is odd: >>> user=> (/ 1.0 0.0) >>> #<CompilerException java.lang.ArithmeticException: Divide by zero >>> (NO_SOURCE_FILE:0)> >>> >>> Shouldn't it be Double/POSITIVE_INFINITY? > > I think there's still room for an argument here, if anyone wants to > have one. > > http://scienceblogs.com/goodmath/2008/10/infinity_is_not_a_number.php > > I'm not convinced that x/0 is arithmetically infinity thanks to Mark's > blog post there and it sure bugs me when I do something stupid and get > Infinity back instead of an error. It's like a timebomb in my code, > concealing where the real mistake was. I do like having the constant > there for doing algorithms that depend on it (Dijkstra's SSSP comes to > mind) but I think x/0 is an error (unless it's 0/0). > > — > Daniel Lyons > > > > >
using math knowledge to answer (corner) cases of the floating point spec is silly people using doubles should be able to expect doubles to behave like doubles -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---