bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread Tim Olsen
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

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread JvJ
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

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread Tim Olsen
I take it you are referring to the difference in capitalization. I am using java 1.7.0_07 on Mac OS X 10.7.5. $ java -version java version 1.7.0_07 Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode) On Tue, Oct 30, 2012 at 2:35

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread AtKaaZ
As I tested, looks like when either of the args are double ie. 1.0 instead of 1 then the code that checks for and shows divide by zero is not reached, which is this code: static public Number divide(Object x, Object y){ Ops yops = ops(y); if(yops.isZero((Number)y)) throw new

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread AtKaaZ
Upon further research looks like: = *(/ 1 0.0)* Infinity triggers this method: clojure.lang.Numbers.*divide(long, double)* *static public double divide(long x, double y){ return x / y; }* =* (/ 1.0 0)* Infinity triggers this method: clojure.lang.Numbers.*divide(double, long)* *static public