bus error in Integer calculations
Geraint Jones
Geraint.Jones at wolfson.ox.ac.uk
Thu Dec 8 23:43:08 UTC 2016
I have this little demo which I use for sixth formers which includes
calculating in fairly rapid order the sum of the digits of the
10^9th Fibonacci number. (I haven't got enough physical memory to
do the same for the 10^10th number without thrashing...) It fell
over on a flashy new macbook I was going to use for the presentation
the other day; indeed I found I couldn't even calculate the sum of
the digits of the 10^6th number.
I've reduced the problem to calculating numbers as large as 2^10000000
(as an Integer, of course), which works on all the ghci 7.8.4
implementations I can find on various machines around the department,
but which falls over on the 8.0.1 implementation on my macbook.
2^1000000 is fine, but 2^10000000 causes a bus error which may well
be a stack overflow in libHSinteger-gmp-1.0.0.1-ghc8.0.1.dylib
I don't seem to have easy access to 8.0.1 elsewhere or other
implementations on a mac. Does anyone have a handle on whether this
is a problem with the sizing of the mac implementation or whether it
is a pervasive 8.0.1 problem? Either way, it doesn't seem friendly
that it manifests as an uncaught bus error.
More information about the Glasgow-haskell-users
mailing list