From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Something strange about the"Search 1D Array" function,if there is some kind of bug of LabVIEW?


@OEM_Dev wrote:

I suppose that's what I get for trusting inherited code, not that I frequently check floating point numbers for equality. I did find a rather interesting article that seems to explain why someone before me did it that way and why I should not continue to follow it

 

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


Thats why that link is in the documentation 😄

The ULP is not allways the "Best approach" for everything.  But, neither are the others always suffient.  I had a case where a client needed a ULP approach for measurments with vastly divergent magnitudes and only one comparision could be selected.  (the limit and type of comparision was read from file).  The ULP approach worked wonders for them and I'm grateful that Altenbach had partially implemented the algorithm (the NaN = NaN Bool was left in for regression where some engineers missed a few points in IEEE 754)


"Should be" isn't "Is" -Jay
0 Kudos
Message 21 of 25
(933 Views)

@hmarcano wrote:

Hello OEM_Dev

 

You might want to try something like this. Just enter the precision desired!

 

compare floats.png


Does not work for very large or very small numbers. Often useful in testing though


original.png

Is more often seen as X/Y<1-epsilon.
 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 22 of 25
(928 Views)

@hmarcano wrote:

Hello OEM_Dev

 

You might want to try something like this. Just enter the precision desired!

 

compare floats.png


There is a primitive for Power of 10. Why clutter the diagram?

 

What is your definition of "precision"?

 

For example 10e+40 and 10e+41 differ by only one decimal digit, but your code says they are equal.

 

 

0 Kudos
Message 23 of 25
(919 Views)

Thats correct, if you want to extend the range you can go with I64 datatype. That would give you a range of -1e19 to 1e19.

 

Thanks for pointing that out Jeff, i figured somebody would bring it up 🙂

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

Wisdom is the principal thing; therefore get wisdom: and with all thy getting get understanding. Proverbs 4:7
0 Kudos
Message 24 of 25
(916 Views)

Another good way to search floating numbers.

 

search floating.png

0 Kudos
Message 25 of 25
(906 Views)