1. Implementing the exponential function
Do all supported C compilers know about double ldexp(double x,int pw2), which
multiplies a real by a power of 2?
If not, then exp() can properly be implemented call()ing machine code. But the
overhead of call() could be an issue.
power(E,x) is not as acurate as can be, so an alternate form is desirable, even
though this definition is mathematically correct.
CChris
2. Re: Implementing the exponential function
CChris wrote:
>
>
> Do all supported C compilers know about double ldexp(double x,int pw2), which
> multiplies a real by a power of 2?
> If not, then exp() can properly be implemented call()ing machine code. But the
> overhead of call() could be an issue.
>
> power(E,x) is not as acurate as can be, so an alternate form is desirable,
> even
> though this definition is mathematically correct.
>
> CChris
They should. ldexp() (the variant that takes a double and returns a double) is
standard C89.
Regards, Alexander Toresson