1. Implementing the exponential function
- Posted by CChris <christian.cuvier at ag?icultur?.gouv.fr> Sep 12, 2007
- 581 views
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
- Posted by Alexander Toresson <alexander.toresson at gm?il.?om> Sep 15, 2007
- 520 views
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