BigInt + 0.5 = Infinity?

2010-10-08 Thread Miki
If the following intentional? user= (defn fact [n] (reduce * 1 (range 1 (inc n #'user/fact user= (fact 1000) 402387260077093773543702433923003985719374864210714632543799910... user= (+ 0.5 (fact 1000)) Infinity -- You received this message because you are subscribed to the Google Groups

Re: BigInt + 0.5 = Infinity?

2010-10-08 Thread Per Vognsen
Sure. BigInteger.doubleValue() casts to infinity if the value is too large to be represented: user (double (fact 1000)) Infinity You could try this using BigDecimals instead of doubles: user (+ 0.5M (fact 1000)) -Per On Sat, Oct 9, 2010 at 11:08 AM, Miki miki.teb...@gmail.com wrote: If the