scientific
scientific copied to clipboard
Integer overflow in exponent
scientific 1 (maxBound::Int) * scientific 1 (maxBound::Int) evaluates to 1.0e-2.
Yes, this is unfortunate. Scientific
uses an Int
to represent the exponent so it suffers from the same integer overflows that Int
suffers from. I've an old TODO to switch the exponent to Integer
to make Scientific
truly arbitrary precision.
I started doing some work on this on the integer-exponent branch.
I'd prefer we throw an impure error instead of producing wrong values, till we can get arbitrary precision would a patch be accepted that calls Prelude(error)
on any operation that would result in corruption?