Mail Archives: djgpp-workers/2000/05/19/08:15:49
On Fri, 19 May 2000, Martin Stromberg wrote:
> Ok, how doI easily say 2^-16, 2^-32 and 2^-48 to the compiler? Is it
> ok to use pow(2, -16) etc. (efficiency)?
No. Use ldexp(), it's usually much more efficient than pow(). If there is
no special support for the operation 'multiply by 2^exponent implemented
in the FP hardware, the library implementor will fall back to using pow(),
but by using ldexp, you're giving him a chance to provide a better method.
In a nutshell, ldexp() is for floating point types what bitshifts are
for integers.
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -