I executed the same test in java and got "infinity" as a result. What
version of the JDK are you using? I'm using 1.7
On Tuesday, 30 October 2012 11:10:17 UTC-4, Tim Olsen wrote:
>
> Hello Clojurians.
>
> Normally by some IEEE floating-point standard, division by 0.0 should
> give Infinity (or NaN if the divisor is also 0.0). This is the case
> when using primitive doubles in clojure:
>
> (/ 1.0 0.0)
> => Infinity
>
> And even when using boxed Doubles in java:
>
> public class BoxedDoubleDivideZero {
>
> public static void main(String[] args) {
> Double a = new Double(4.0);
> Double b = new Double(0.0);
>
> System.out.println(a/b);
> }
> }
>
> $ javac BoxedDoubleDivideZero.java
> $ java BoxedDoubleDivideZero
> Infinity
>
> But it is not the case when using boxed Doubles in clojure:
>
> (/ (Double. 1.0) (Double. 0.0))
> ArithmeticException Divide by zero clojure.lang.Numbers.divide
> (Numbers.java:156)
>
> Is this considered a bug or feature?
>
> Thanks,
> Tim
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en