procps-ng 4.0.3 tests fail on x86

hi,

when running the test suite on 32-bit x86, one test fails with:

=======================================
   procps-ng 4.0.3: ./test-suite.log
=======================================

# TOTAL: 7
# PASS:  6
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: src/tests/test_strtod_nol
===============================

FAIL: strtod_nol_or_err("123") != 123.000000
FAIL src/tests/test_strtod_nol (exit status: 1)

this is most likely because the comparison is directly on floats:

        if(strtod_nol_or_err(tests[i].string, "Cannot parse number") !=
           tests[i].result) {

which probably has some very tiny difference on x86; i.e., it is not 'safe' or 'accurate' to compare floats directly with !=.

generally you want to do something like:

fabs(a - b) < epsilon;

for some small value of epsilon; this gets rid of potential tiny float rounding issues.

Assignee Loading
Time tracking Loading