Mail Archives: djgpp/1998/10/15/12:05:27
> 11.6 Floating point inaccuracies when using emulator
> ====================================================
> **Q*: I am experiencing inaccurate results in some floating point
> calculations, sometimes in the 2nd or 3rd significant digit (like getting
> 118.401 instead of 120.0). This is really unacceptable! (And no, I'm *not*
> using a buggy Pentium CPU.)*
> *A*: Are you using the emulator? If so, it might be that the emulator isn't
> as accurate as you expect. One particular known problem is that it does a
> bad job when computing the `atan' function. So if you use `atan(1.)' to get
> the value of `Pi', that might be your problem. Solution: make `Pi' a
> constant, as God intended. The header file `<math.h>' includes the constant
> `M_PI' which you can use; or get the value of Pi from the net
> (http://www.diku.dk/~terra/pi.html).
Another solution to use WMEMU emulator that known to hold 7 significant digits
for `float' (but fails for `double'). To try the difference just download
wmemu binary package and set environment EMU387=path_to_wmemu\wmemu387.dxe
- Raw text -