LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

greater than or equal function not working properly

Solved!
Go to solution

Hi all,

 

Im curious if anyone has seen this before or knows why its not working.  I have a greater than or equal function and i am comparing two doubles.  Ive probed the numbers entering the function so i know that the 2 numbers entering the function are the same.

 

Problem is i dont get a true from the function until the comparasin value is greater than the number entering.

 

Using LV2011.

 

Any reason this happens?

 

Thank you,

Matt



-Matt
0 Kudos
Message 1 of 7
(4,534 Views)
Solution
Accepted by Ben
0 Kudos
Message 2 of 7
(4,526 Views)
Ok - and what was the exact solution?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(4,487 Views)

I actually dont know.  For me i just lowered the number it was compared to ha Smiley Very Happy in the link i posted it just says funny behavior can be expected.  I didnt really look any further into it.  What exactly would be the solution to this?

 

Thanks,

 

matt



-Matt
0 Kudos
Message 4 of 7
(4,484 Views)

The problem with floating points is that they are not exact.  If they are off by a bit or two, your numbers are not equal.  This is because a large majority of numbers cannot be accurately saved in 64 bits.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(4,460 Views)
That makes a lot of sense and I assumed something like that. The driver I was working with for an Agilent was using floating point inputs and outputs. That's why I left them in that representation. In this circumstance would it be a good idea to convert them to integers? I know some rounding will of course happen but I'm not too worried with the precision.


-Matt
0 Kudos
Message 6 of 7
(4,438 Views)

Hi Matt,

 

would it be a good idea to convert them to integers?

That depends on your numbers - you didn't tell us anything about them before…

When Agilent chose DBL datatype they did this for a reason (atleast I guess). So using integers instead might lead to other problems!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(4,420 Views)