tests: Dont compare floats with ==

Comparing floats with == is bad and I should feel bad I did this.
The problem is if something is close to, but not quite the exact
same fails tests.

I have used an epsilon of 1 because we don't care about accuracy,
just that the function works well enough.

References:
 issue procps-ng/procps#271
 https://how-to.fandom.com/wiki/Howto_compare_floating_point_numbers_in_the_C_programming_language

Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
Craig Small
2023-03-01 17:20:42 +11:00
parent 806eb270f2
commit 9b2f49166b
2 changed files with 10 additions and 0 deletions

4
NEWS
View File

@@ -1,3 +1,7 @@
procps-ng-NEXT
---------------
* tests: dont compare floats with == issue #271
procps-ng-4.0.3
---------------
* library