10-22-2015 03:21 PM
@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)
10-22-2015 03:25 PM - edited 10-22-2015 03:30 PM
@hmarcano wrote:
Hello OEM_Dev
You might want to try something like this. Just enter the precision desired!
Does not work for very large or very small numbers. Often useful in testing though
Is more often seen as X/Y<1-epsilon.
10-22-2015 03:37 PM
@hmarcano wrote:
Hello OEM_Dev
You might want to try something like this. Just enter the precision desired!
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.
10-22-2015 03:39 PM
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 🙂
10-22-2015 03:55 PM
Another good way to search floating numbers.