I've established that the Microsoft implementations of exp(double) in the VS2010 C library use different algorithms on Win32 (i.e. 32-bit x86) and x64 platforms, even though I've enabled SSE2 for the x86 platform and verified that the SSE2 code path is taken within exp(). Unfortunately, the different algorithms produce slightly different results (by 1ulp) for some operands. In these cases, either result is acceptable to us in principle, but the lack of consistency between Win32 and x64 builds is problematic for us during testing. Where can I find a good (i.e. accurate and fast) alternative implementation of exp(double) that I can use on both platforms? I'd be happy to have an assembly code solution using SSE2 instructions, and I can translate it from 32 to 64 bits or v.v. if necessary.
Asked
Active
Viewed 294 times
1 Answers
0
Probably it is better to rely on the compiler and use the exp implementation from http://www.netlib.org/fdlibm/e_exp.c . It is an accurate implementation (1ulp) . Compile with sse2 on, for both x86 en x64 and the results should be exactly the same on these platforms. The source code does not offer much opportunities for using mulpd (or _mm_mul_pd) and addpd instead of mulsd and addss. Therefore an assembly code solution might not be very profitable.

wim
- 3,702
- 19
- 23