Showing results for 
Search instead for 
Did you mean: 

Problem with the Greater? function

I've run into an issue with Labview 8.5's Greater? function.  (>)    If I run the following code I get a True when the input values are equal.   
This is a problem I've found in the field, and need to resolve ASAP.   
Can anyone tell me why 5.1 is greater than 5.1?     The function seems to work with integer values.
This was also confirmed to exist in LV 8.2
0 Kudos
Message 1 of 9

Hi lclutchl,

that´s no bug. This both numbers are not equal, because this are floating point numbers. Look at the entire number with all decimal places.

Here is a link for additional informations:


Message Edited by MikeS81 on 04-01-2008 07:25 PM
Message 2 of 9

look again. I've increased the precision...

Message Edited by Jorge Amaral on 04-01-2008 12:25 PM
Software developer

Message 3 of 9

fractional decimal values can not always be fully represented in floating point representation, because they cannot be represented exactly by a finite amount of bits.

If you display all digits, you'll see that you are actually calculalting:

5.20000000000000018 - 0.100000000000000006 = 5.10000000000000053 while 5.1 is actually 5.09999999999999964 and thus smaller than the sum.

Message 4 of 9
This is the result of a well known issue regarding the finite representation of numbers in binary in the computer. Numbers which are exactly expressed as decimal fractions may be infinitely repeating "fractions" in binary. Expand the display to show all the digits and your will see.


Message Edited by johnsold on 04-01-2008 01:31 PM
Message 5 of 9
Interesting.. Mike is absolutely right!  Why is it that when I manually enter "5.1" it rounds it to "5.0999xxxxxx"?

Message 6 of 9

Got it!    Now that I know this issue exists I can account for it!    



Thanks everyone.




Message 7 of 9

Vikas K:

Interesting.. Mike is absolutely right!  Why is it that when I manually enter "5.1" it rounds it to "5.0999xxxxxx"?

because it is impossible to represent 0.1 with the number of binary decimals places available to the number.

Message Edited by JeffOverton on 04-01-2008 01:56 PM
Message 8 of 9

It makes sense. Thanks Jeff.


Message 9 of 9