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
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
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
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
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