Aaron Denney wrote:
On 2008-02-14, Roman Leshchinskiy <[EMAIL PROTECTED]> wrote:
Richard A. O'Keefe wrote:
SafeInt is what you should use when you *THINK* your results should all fit
in a machine int but aren't perfectly sure. (And this is nearly all the
time.)
Again, I strongly disagree. You should use Integer unless your program
is too slow and profiling shows that Integer is the culprit. If and only
if that is the case should you think about alternatives. That said, I
doubt that your SafeInt would be significantly faster than Integer.
Why? GMP is pretty good, but it's not going to be anywhere near
hardware speeds.
This how Integer is defined in the libraries:
data Integer
= S# Int# -- small integers
| J# Int# ByteArray# -- large integers
As long as the Int# doesn't overflow, you don't call any GMP routines.
Roman
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe