nemequ / munit

µnit is a small testing framework for C
https://nemequ.github.io/munit/
Other
578 stars 76 forks source link

munit_assert_double_equal doesn't care about scale of the values #75

Open NolanDeveloper opened 3 years ago

NolanDeveloper commented 3 years ago

Example:

munit_assert_double_equal(1e100, 1.0000000001e100, 1); // fails

For the same reasons that the next test passes the test above should pass too.

munit_assert_double_equal(1, 1.0000000001, 1);

The better ways of comparing floating point numbers are described here: https://stackoverflow.com/a/253874/4626533