View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Floating point number comparison

One should never compare two real numbers (aka floating point) for EXACT
equality.
Your approach =ABS(x-y)<=EPSILON is the way to go.
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Edward Ulle" wrote in message
...
I know this is the subject of many prior threads, but, I'm having
trouble comparing floatinp point numbers. Values in registers and
values in memory are not exactly equal, even though they were calculated
identically.

I was wondering if there is a library of functions to compare floating
point numbers, equal, less than, greater than, positive numbers and
negative numbers.

So far I only have one that I have confidence in.

x=y is Abs(x-y)<EPSILON.

Any leads would be appreciated.



*** Sent via Developersdex http://www.developersdex.com ***