Some courses and learning paths on NI Learning Center may not appear on learner dashboards. Our team is actively investigating.

If you encounter access issues, please contact services@ni.com and include the learner’s name, email, service ID or EA number, and the list of required courses.

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,400 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,393 Views)

Yes, you're right. Sorry. 😄

Message 13 of 17
(3,384 Views)
No sorry.... Thanks,
Message 14 of 17
(3,380 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,364 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,350 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,338 Views)