You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This is a bug which is inherent throughout all languages due to the non-trivial floating point arithmetic varying implementations across platforms, this will result in certain platforms failing tests for various float-based operations that are non-trivial.
To Reproduce
Run cargo test on MacOS, and probably a few other OS's.
Expected behavior
All tests should pass, as these failures are simply due to floating point inaccuracies.
Build environment (please complete the following information):
Additional context
This should be solvable with use of a tolerance or by using some approximately equal assertion, just quickly looking over these, approx or float-cmp, the latter seems much more often used, this may also be used in other cases where tests fail in future cases for floating point arithmetic.
The text was updated successfully, but these errors were encountered:
In fact, with float-cmp we can reinstate the builtins::math::tests::tan test, as this was commented due to a similar issue, this is linked to #260 where the test had to be commented out. I think perhaps it may be valuable to refactor many float-based tests in the math module to using float-cmp for assertions that they pass.
Specifically for refactoring the currently commented test for tan, should I submit this in a separate PR branched from this PR?
* Added approx_eq! macro for expm1 tests.
Added approx_eq! macro for expm1 tests due to floating point arithmetic
inaccuracies, using default ULP & epsilon values. approx_eq! macro does
not work for NaN values, however, for tests this should be okay anyway!
Solves #664.
* Modified Cargo.toml to remove unneeded feature.
Removed std feature as was unused in test.
* Moves `float-cmp` to Dev Dependencies
Refactors tan() unit test, previously unused, to use approx_eq!() macro
for assertion to pass on CI.
* Fixes cargo fmt errors
Describe the bug
This is a bug which is inherent throughout all languages due to the non-trivial floating point arithmetic varying implementations across platforms, this will result in certain platforms failing tests for various float-based operations that are non-trivial.
To Reproduce
Run
cargo test
on MacOS, and probably a few other OS's.Expected behavior
All tests should pass, as these failures are simply due to floating point inaccuracies.
Build environment (please complete the following information):
Additional context
This should be solvable with use of a tolerance or by using some approximately equal assertion, just quickly looking over these,
approx
orfloat-cmp
, the latter seems much more often used, this may also be used in other cases where tests fail in future cases for floating point arithmetic.The text was updated successfully, but these errors were encountered: