Author: gbrunmar
Date: Sat Aug 22 15:06:11 2009
New Revision: 42843
URL:
http://svn.reactos.org/svn/reactos?rev=42843&view=rev
Log:
- Implemented MSVC version of exp
Modified:
trunk/reactos/lib/sdk/crt/math/i386/exp.c
Modified: trunk/reactos/lib/sdk/crt/math/i386/exp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/exp.…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/i386/exp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/i386/exp.c [iso-8859-1] Sat Aug 22 15:06:11 2009
@@ -42,6 +42,22 @@
return __value;
#else
-#error IMPLEMENT ME
+ register double __val;
+ __asm
+ {
+ fld1 // store 1.0 for later use
+ fld __x
+ fldl2e // e^x = 2^(x * log2(e))
+ fmul st,st(1) // x * log2(e)
+ fld st(0)
+ frndint // int(x * log2(e))
+ fsub st,st(1) // fract(x * log2(e))
+ fxch
+ f2xm1 // 2^(fract(x * log2(e))) - 1
+ fadd st,st(3) // + 1.0
+ fscale
+ fstp __val
+ }
+ return __val;
#endif /*__GNUC__*/
}