LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure LSBits-of-difference between floats (if possible)

Hi everyone,

I just wanted to throw in a small tidbit regarding functional tolerances. A new constant was added in LabVIEW 8 to the numerical palette, the so-called Machine Epsilon. This is a double-precision numeric representing the positive non-zero number with the least absolute value possible. It comes out to around 2.2E-16.

I thought it might be useful for some of these tests.

Jarrod S.
National Instruments
Message 11 of 17
(3,181 Views)

Hi Altenbach,

Thank you for response, but ... 32 is too small to make 2 and 1.99989998 equal in my VI. Here 32 means 4.48415509E-44 in single floating point number. Try tolerance=1000, for example.

I think denormalized and normalized are always different. Is there any example for identical denormalized and normalized?

Thanks again,

Xu

Message 12 of 17
(3,174 Views)

Yes, you're right. Sorry. 😄

Message 13 of 17
(3,165 Views)
No sorry.... Thanks,
Message 14 of 17
(3,161 Views)

Hi XU,

I was too ignorant to appreciate your solution when you posted it.    Finally got around to exploring/testing your VI, but still didn't understand floats well enough to trust your solution!  Finally ended-up here:

http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

My conclusions is: You're smart!

Huge thanks for the perfect solution. Smiley Happy

When they give imbeciles handicap-parking, I won't have so far to walk!
Message 15 of 17
(3,145 Views)
Ditto.
 
Anyway, using LabVIEW 8 which supports 64bit integers, we can now easily adapt it to support comparison of DBLs. 😄
 
Here's my attempt (LabVIEW 8.0), please test if it works!
Message 16 of 17
(3,131 Views)
Hi Altenbach,
      Saved your VI - but can't test it until I break-down and purchase 8.0 (really, I'm waiting for 8.1 Smiley Happy )
 
Anyway, thanks for the code (and for the stars Smiley Wink )
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 17 of 17
(3,119 Views)