11-17-2005 07:54 AM
11-17-2005 08:01 AM
Hi Paul
Never compare floating point numbers to 0. In addition to that - if possible, never compare floating point numbers with each other.
Always compoare if one is bigger than the other.
You must know, that for example 3.2 is not just saved as 3.2.
Have a look at this wikipedia article - it gives you a brief overview of this topic.
http://en.wikipedia.org/wiki/Floating_point_numbers
Hope this helps.
Thomas
11-17-2005 08:15 AM
Subtract one from the other and check the magnitude of the difference.
Ben
11-17-2005 09:18 AM
11-18-2005 08:07 AM
11-18-2005 08:23 AM
11-18-2005 11:11 AM - edited 11-18-2005 11:11 AM
@PaulG. wrote:
.., save the cluster to disk, read back the data, and read the cluster and compare the two values. ...
If you would write the cluster to file in binary form, the comparison should always succeed. How are you writing the values?
Of course in the general case, you should always compare DBLs within a certain tolerance by comparing their absolute difference with a threshold (e.g. 0.0001) as in this image:

Message Edited by altenbach on 11-18-2005 09:13 AM
11-18-2005 10:12 PM
11-18-2005 10:59 PM - edited 11-18-2005 10:59 PM
Message Edited by Dynamik on 11-18-2005 11:00 PM
11-19-2005 08:39 AM