swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: odd bug in Cygnus?


From: Marcus G. Daniels
Subject: Re: odd bug in Cygnus?
Date: 30 May 1998 22:19:09 -0700

You're playing a dangerous game when you mix inexact and exact numbers
and want exact answers.  Note that this behavior is not specific to 
Win95, you'll get the same thing with gcc under x86 GNU/Linux.  I suspect
the cause is this (from the GNU CC manual).

   * On 68000 and x86 systems, for instance, you can get paradoxical
     results if you test the precise values of floating point numbers.
     For example, you can find that a floating point value which is not
     a NaN is not equal to itself.  This results from the fact that the
     floating point registers hold a few more bits of precision than
     fit in a `double' in memory.  Compiled code moves values between
     memory and floating point registers at its convenience, and moving
     them into memory truncates them.

So I think a way to avoid the problem would be to write the results of
such arithmetic to a double variable first, and then cast that.  

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]