lines 11-75 of file: cpp/include/cmpad/near_equal.hpp {xrst_begin cpp_near_equal} {xrst_spell fabs os rel std vec } C++ Check That Values are Nearly Equal ###################################### Prototype ********* {xrst_literal // BEGIN PROTOTYPE // END PROTOTYPE } Nearly Equal ************ Checks if two values are nearly equal; i.e., if {xrst_code cpp} std::fabs(x - y) <= abs_error {xrst_code} where the absolute error *abs_error* is defined below. Type **** is the type of the operands we are checking. x * is the left operand in the nearly equal check. y * is the right operand in the nearly equal check. rel_error ********* is the relative error used during the comparison. vec *** This vector specifies extra values to include when scaling the relative error. os ** If the values are not nearly equal, a messages is written to this stream describing the comparison failure. abs_error ********* #. *scale* is the maximum of the absolute value of *x*, *y* , and the elements of *vec* #. *tiny* is the minimum positive normalized value of type *Scalar* #. *abs_error* is maximum of *tiny* and *rel_error* times *scale* . {xrst_toc_hidden cpp/xam/near_equal.cpp } :ref:`xam_near_equal.cpp-name` contains an example and test of this routine. {xrst_end cpp_near_equal}