Next: , Previous: TEST_RUN_FP, Up: Test Macros


3.2.7 TEST_RUN_FP_TOL

Synopsis

     #include <testlib.h>
     
     TEST_RUN_FP_TOL(desc, stmt, expr, res, tol )
     TEST_RUN_FP_TOL_LINE(line, desc, stmt, expr, res, tol )

Parameters

line
the line number to output
desc
a short description of the test being performed
stmt
a statement to be executed, independent of the expression. the statement may be arbitrarily complex.
expr
a floating point expression to evaluate
res
the expected result of the floating point expression
tol
the tolerance within which the expr and the res are equivalent.

Description

TEST_RUN_FP_TOL is called to determine the equivalence of a floating point expression against an expected result within a specified tolerance range. If the numeric difference between the two values is less than the specified tolerance, they are considered equivalent.

Example

     TEST_RUN_FP_TOL( "float equiv", foo(&x), 33 * x, 36, 0.01 );