assert_isapprox
Check that computed and expected values are approximately equal.
Syntax
assert_isapprox(computed, expected)
assert_isapprox(computed, expected, precision)
res = assert_isapprox(computed, expected, precision)
[res, msg] = assert_isapprox(computed, expected, precision)
Input argument
computed - a value: numeric matrix, sparse double, a multidimensional matrix
expected - a value: numeric matrix, sparse double, a multidimensional matrix
expected - a double value. default precision is 0.
Output argument
res - a logical value
msg - a string value, the error message. If res == true, then errormsg == ''. If res == false, then msg contains the error message.
Description
assert_isapprox raises an error if computed value is not approximately equal to expected value.
This function compares two floating point numbers, which allows to check that two numbers are "approximately" equal, i.e. that the relative error is small.
Used function(s)
isapprox
Examples
See also
History
Version | Description |
---|---|
1.0.0 | initial version |
Author
Allan CORNET
Last updated