mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-28 15:59: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:
|
||||
// a = First 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:
|
||||
// test1 = 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()
|
||||
// Synopsis: Assert that a value is expected.
|
||||
// Synopsis: Assert that a value is approximately what was expected.
|
||||
// Topics: Error Checking, Debugging
|
||||
// See Also: no_children(), no_function(), no_module(), assert_equal()
|
||||
// Usage:
|
||||
// assert_approx(got, expected, [info]);
|
||||
// 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
|
||||
// an assertion is thrown to stop execution.
|
||||
//
|
||||
// Returns false if both 'got' and 'expected' are 'nan'.
|
||||
// Arguments:
|
||||
// got = The value actually received.
|
||||
// expected = The value that was expected.
|
||||
|
@ -924,6 +926,8 @@ module assert_approx(got, expected, info) {
|
|||
// Description:
|
||||
// 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.
|
||||
//
|
||||
// Returns true if both 'got' and 'expected' are 'nan'.
|
||||
// Arguments:
|
||||
// got = The value actually received.
|
||||
// expected = The value that was expected.
|
||||
|
|
Loading…
Reference in a new issue