Re: cannot get more than 94 fibonacci numbers -> integer overflow

2013-03-25 Thread Jim foo.bar
Cool, thanks guys :) Jim On 25/03/13 15:34, David Powell wrote: On Mon, Mar 25, 2013 at 3:24 PM, Jim foo.bar > wrote: On 25/03/13 15:22, Ben Wolfson wrote: The 94th fibonacci number is greater than Long/MAX_VALUE, so it overflows. It is usi

Re: cannot get more than 94 fibonacci numbers -> integer overflow

2013-03-25 Thread David Powell
On Mon, Mar 25, 2013 at 3:24 PM, Jim foo.bar wrote: > On 25/03/13 15:22, Ben Wolfson wrote: > >> The 94th fibonacci number is greater than Long/MAX_VALUE, so it >> overflows. It is using longs. >> > > I seeshouldn't Clojure auto-promote it to a BigInt then? It doesn't by default. There are

Re: cannot get more than 94 fibonacci numbers -> integer overflow

2013-03-25 Thread Akhil Wali
Use 0N instead of 0. On Mar 25, 2013 8:52 PM, "Ben Wolfson" wrote: > On Mon, Mar 25, 2013 at 8:05 AM, Jim foo.bar wrote: > > > > Since Clojure prefers longs to ints and since I'm not using any type > hints, > > I don't understand why I get an integer overflow... > > In the traceback I get for th

Re: cannot get more than 94 fibonacci numbers -> integer overflow

2013-03-25 Thread Jim foo.bar
On 25/03/13 15:22, Ben Wolfson wrote: The 94th fibonacci number is greater than Long/MAX_VALUE, so it overflows. It is using longs. I seeshouldn't Clojure auto-promote it to a BigInt then? Jim -- -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: cannot get more than 94 fibonacci numbers -> integer overflow

2013-03-25 Thread Ben Wolfson
On Mon, Mar 25, 2013 at 8:22 AM, Ben Wolfson wrote: > On Mon, Mar 25, 2013 at 8:05 AM, Jim foo.bar wrote: >> >> Since Clojure prefers longs to ints and since I'm not using any type hints, >> I don't understand why I get an integer overflow... > > In the traceback I get for this: > (take 94 (lazy-

Re: cannot get more than 94 fibonacci numbers -> integer overflow

2013-03-25 Thread Ben Wolfson
On Mon, Mar 25, 2013 at 8:05 AM, Jim foo.bar wrote: > > Since Clojure prefers longs to ints and since I'm not using any type hints, > I don't understand why I get an integer overflow... In the traceback I get for this: (take 94 (lazy-seq (cons 0 (lazy-seq (cons 1 (map + fibs (rest fibs))) Ar

cannot get more than 94 fibonacci numbers -> integer overflow

2013-03-25 Thread Jim foo.bar
I've literally tried all the variations of fibonaci sequences i could find! all of them throw an ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388) as soon as I try more than 94 elements! my favourite version is this (from Christophe Grand ): (defn