LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

About Comparison Functions

Solved!
Go to solution

Comparing two different data types (single and double precision) of the same values, two different results are got using the same loop.

In some cases, the while loop executes different times.

The program and results are attached.

Who knows why the results are different?

 

 

Download All
0 Kudos
Message 1 of 3
(2,164 Views)

Many simple decimal fractional values (e.g. 0.1) do not have an exact representation in binary. Set the table to show e.g. 18 decimal digits and you'll see what's going on.

0 Kudos
Message 2 of 3
(2,143 Views)
Solution
Accepted by topic author shuimu888

To add to altenbach's reply, you should really read this: http://www.ni.com/white-paper/7612/en/. While it is an NI document what it describes is true of every computing device in the world that uses IEEE 754 floating point notation and is not specific to LabVIEW. Its one of the common issues software engineers of all walks of life inevitably hit.

0 Kudos
Message 3 of 3
(2,136 Views)