mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
epsilon issues.
This commit is contained in:
parent
b890bcacc0
commit
477a0920bc
2 changed files with 7 additions and 3 deletions
|
@ -23,7 +23,7 @@
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// a = First value.
|
// a = First value.
|
||||||
// b = Second value.
|
// b = Second value.
|
||||||
// eps = The maximum allowed difference between `a` and `b` that will return true.
|
// eps = The maximum allowed difference between `a` and `b` that will return true. Defaults to 1e-9.
|
||||||
// Example:
|
// Example:
|
||||||
// test1 = approx(-0.3333333333,-1/3); // Returns: true
|
// test1 = approx(-0.3333333333,-1/3); // Returns: true
|
||||||
// test2 = approx(0.3333333333,1/3); // Returns: true
|
// test2 = approx(0.3333333333,1/3); // Returns: true
|
||||||
|
|
|
@ -883,15 +883,17 @@ function _valstr(x) =
|
||||||
|
|
||||||
|
|
||||||
// Module: assert_approx()
|
// Module: assert_approx()
|
||||||
// Synopsis: Assert that a value is expected.
|
// Synopsis: Assert that a value is approximately what was expected.
|
||||||
// Topics: Error Checking, Debugging
|
// Topics: Error Checking, Debugging
|
||||||
// See Also: no_children(), no_function(), no_module(), assert_equal()
|
// See Also: no_children(), no_function(), no_module(), assert_equal()
|
||||||
// Usage:
|
// Usage:
|
||||||
// assert_approx(got, expected, [info]);
|
// assert_approx(got, expected, [info]);
|
||||||
// Description:
|
// Description:
|
||||||
// Tests if the value gotten is what was expected. If not, then
|
// Tests if the value gotten is what was expected, plus or minus 1e-9. If not, then
|
||||||
// the expected and received values are printed to the console and
|
// the expected and received values are printed to the console and
|
||||||
// an assertion is thrown to stop execution.
|
// an assertion is thrown to stop execution.
|
||||||
|
//
|
||||||
|
// Returns false if both 'got' and 'expected' are 'nan'.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// got = The value actually received.
|
// got = The value actually received.
|
||||||
// expected = The value that was expected.
|
// expected = The value that was expected.
|
||||||
|
@ -924,6 +926,8 @@ module assert_approx(got, expected, info) {
|
||||||
// Description:
|
// Description:
|
||||||
// Tests if the value gotten is what was expected. If not, then the expected and received values
|
// Tests if the value gotten is what was expected. If not, then the expected and received values
|
||||||
// are printed to the console and an assertion is thrown to stop execution.
|
// are printed to the console and an assertion is thrown to stop execution.
|
||||||
|
//
|
||||||
|
// Returns true if both 'got' and 'expected' are 'nan'.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// got = The value actually received.
|
// got = The value actually received.
|
||||||
// expected = The value that was expected.
|
// expected = The value that was expected.
|
||||||
|
|
Loading…
Reference in a new issue