Floating point exponentiation
tg at gmplib.org
Tue Mar 23 11:15:18 CET 2010
David Gillies <daggillies at gmail.com> writes:
What does 'big' mean? Forget floating point: exp(n) for an n that fits
in a uint32_t will exhaust, or as near as makes no difference, memory
in any normal machine. exp(2^32) is around the billion-byte mark in
radix 256 (eight bit binary.) Even if you can fit your operand (and
its destination) in main memory, any computation beyond O(n) is going
to be silly. 64 bit? Nah. The exponent ceases to be representable in a
first-order scheme. The mantissa waved bye-bye through the back window
many miles back.
I don't understand this comment.
We're talking about floating-point numbers here, not integers. While
e^2^32 is a large number, it will be possible to represent
approximatively with GMP on a 64-bit machine. (The exponent type is
there typically 64 bits.) It will not need more memory than specified
for the destination variable.
I also do not agree with the statement that computations in \Omega(n)
are silly for numbers with billion digit mantissas. I assume this is
what you mean with "beyond O(n)".
More information about the gmp-discuss