Boa: `builtins::math::tests::expm1` MacOS Fix

Created on 26 Aug 2020  路  3Comments  路  Source: boa-dev/boa

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):

  • OS: MacOS
  • Version: 10.15.6
  • Target triple: Darwin
  • Rustc version: rustc 1.45.2 (d3fb005a3 2020-07-31)

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.

bug test

All 3 comments

I am planning to write a PR, using float-cmp for this, however, I'll wait for the go-ahead!

Go ahead!

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elasmojs picture elasmojs  路  4Comments

attliaLin picture attliaLin  路  3Comments

jasonwilliams picture jasonwilliams  路  6Comments

jasonwilliams picture jasonwilliams  路  4Comments

hello2dj picture hello2dj  路  5Comments