To: eliz AT is DOT elta DOT co DOT il Cc: djgpp AT delorie DOT com References: Message-Id: From: "Leonid Pauzner" Date: Thu, 15 Oct 1998 19:43:49 +0400 (MSD) X-Mailer: dMail [Demos Mail for DOS v2.07a5] Subject: Re: Floating Point emulation problem Lines: 21 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com > 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 `' 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