Microsoft Excel may change the precision mode of the
floating-point control word during its execution. Because of this, C/C++ DLLs
called from Excel that use the standard run-time library may return slightly
different results than expected. The difference is typically less than 10E-15.
↑ Back to the top
C/C++ DLLs or XLLs designed to be used from Excel should
link to the FP10.OBJ library. The Microsoft C/C++ run-time library sets the
default internal precision of the math coprocessor (or emulator) to 64 bits. By
linking your project with FP10.OBJ, you override this default and set the chip
to utilize 80-bit precision. FP10.OBJ must appear before Libc.lib, Libcmt.lib,
or Msvcrt.lib on the linker command line. By linking to FP10.OBJ, you should
see more consistent results. However, even when utilizing 80-bits, Excel is
still limited to 15 digits of precision because of its adherence to the IEEE
754 specification.
↑ Back to the top
78113�
XL: Floating-Point Arithmetic May Give Inaccurate Results
125056�
INFO: Precision and Accuracy in Floating-Point Calculations
Visual C++ Programmer's Guide, under
"Floating-Point Support".
↑ Back to the top