[nhc-bugs] nhc98 bignum div/mod gives wrong answers or
segmentation faults
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Fri Oct 29 05:56:37 EDT 2004
Martin Guy <martinwguy at gmail.com> writes:
> I've trimmed down the sqrt2 example to a small source file
> which is attached and obligingly continues to work under hugs
> and dump core with nhc98.
Yes, I can reproduce the bug. I think it is likely due to nhc98
failing to check the internal representation size of large Integers
correctly, causing some kind of uncaught heap overflow. Certainly,
you can alter the number of digits calculated prior to the core dump
by adjusting the heap size (e.g. with +RTS -H16M -RTS). Nasty, but
at least you get the right answer before crashing!
> I'm afraid that the wrong-answer of pi is rather hard to extract
> into a self-contained fragment as it uses the infinite-precision
> trig functions and they call in the rest of the world.
I suspect that the wrong value of pi is /not/ a manifestation of the
same fault at all. If you want to send that code to me privately, I'm
happy to investigate further.
Regards,
Malcolm
More information about the Nhc-bugs
mailing list