Utilities for comparing floating-point values with tolerance.
More...
|
| CHECKASM_API int | checkasm_float_near_ulp (float a, float b, unsigned max_ulp) |
| | Compare floats using ULP (Units in Last Place) tolerance. More...
|
| |
| CHECKASM_API int | checkasm_float_near_abs_eps (float a, float b, float eps) |
| | Compare floats using absolute epsilon tolerance. More...
|
| |
| CHECKASM_API int | checkasm_float_near_abs_eps_ulp (float a, float b, float eps, unsigned max_ulp) |
| | Compare floats using both epsilon and ULP tolerances. More...
|
| |
| CHECKASM_API int | checkasm_float_near_ulp_array (const float *a, const float *b, unsigned max_ulp, int len) |
| | Compare float arrays using ULP tolerance. More...
|
| |
| CHECKASM_API int | checkasm_float_near_abs_eps_array (const float *a, const float *b, float eps, int len) |
| | Compare float arrays using absolute epsilon tolerance. More...
|
| |
| CHECKASM_API int | checkasm_float_near_abs_eps_array_ulp (const float *a, const float *b, float eps, unsigned max_ulp, int len) |
| | Compare float arrays using both epsilon and ULP tolerances. More...
|
| |
| CHECKASM_API int | checkasm_double_near_abs_eps (double a, double b, double eps) |
| | Compare doubles using absolute epsilon tolerance. More...
|
| |
| CHECKASM_API int | checkasm_double_near_abs_eps_array (const double *a, const double *b, double eps, unsigned len) |
| | Compare double arrays using absolute epsilon tolerance. More...
|
| |
Utilities for comparing floating-point values with tolerance.
These functions compare floating-point values allowing for acceptable differences due to rounding, precision loss, or different computation orders.
◆ checkasm_float_near_ulp()
Compare floats using ULP (Units in Last Place) tolerance.
- Parameters
-
| [in] | a | First value |
| [in] | b | Second value |
| [in] | max_ulp | Maximum acceptable ULP distance |
- Returns
- Non-zero if values are within tolerance, 0 otherwise
Definition at line 511 of file utils.c.
◆ checkasm_float_near_abs_eps()
Compare floats using absolute epsilon tolerance.
- Parameters
-
| [in] | a | First value |
| [in] | b | Second value |
| [in] | eps | Maximum acceptable absolute difference |
- Returns
- Non-zero if |a-b| < eps, 0 otherwise
Definition at line 539 of file utils.c.
Referenced by selftest_test_float().
◆ checkasm_float_near_abs_eps_ulp()
Compare floats using both epsilon and ULP tolerances.
- Parameters
-
| [in] | a | First value |
| [in] | b | Second value |
| [in] | eps | Maximum acceptable absolute difference |
| [in] | max_ulp | Maximum acceptable ULP distance |
- Returns
- Non-zero if within either tolerance, 0 otherwise
Definition at line 554 of file utils.c.
◆ checkasm_float_near_ulp_array()
| CHECKASM_API int checkasm_float_near_ulp_array |
( |
const float * |
a, |
|
|
const float * |
b, |
|
|
unsigned |
max_ulp, |
|
|
int |
len |
|
) |
| |
Compare float arrays using ULP tolerance.
- Parameters
-
| [in] | a | First array |
| [in] | b | Second array |
| [in] | max_ulp | Maximum acceptable ULP distance |
| [in] | len | Number of elements to compare |
- Returns
- Non-zero if all elements are within tolerance, 0 otherwise
Definition at line 529 of file utils.c.
◆ checkasm_float_near_abs_eps_array()
Compare float arrays using absolute epsilon tolerance.
- Parameters
-
| [in] | a | First array |
| [in] | b | Second array |
| [in] | eps | Maximum acceptable absolute difference per element |
| [in] | len | Number of elements to compare |
- Returns
- Non-zero if all elements are within tolerance, 0 otherwise
Definition at line 544 of file utils.c.
◆ checkasm_float_near_abs_eps_array_ulp()
Compare float arrays using both epsilon and ULP tolerances.
- Parameters
-
| [in] | a | First array |
| [in] | b | Second array |
| [in] | eps | Maximum acceptable absolute difference per element |
| [in] | max_ulp | Maximum acceptable ULP distance |
| [in] | len | Number of elements to compare |
- Returns
- Non-zero if all elements are within tolerance, 0 otherwise
Definition at line 560 of file utils.c.
◆ checkasm_double_near_abs_eps()
Compare doubles using absolute epsilon tolerance.
- Parameters
-
| [in] | a | First value |
| [in] | b | Second value |
| [in] | eps | Maximum acceptable absolute difference |
- Returns
- Non-zero if |a-b| <= eps, 0 otherwise
Definition at line 571 of file utils.c.
Referenced by selftest_test_double().
◆ checkasm_double_near_abs_eps_array()
Compare double arrays using absolute epsilon tolerance.
- Parameters
-
| [in] | a | First array |
| [in] | b | Second array |
| [in] | eps | Maximum acceptable absolute difference per element |
| [in] | len | Number of elements to compare |
- Returns
- Non-zero if all elements are within tolerance, 0 otherwise
Definition at line 576 of file utils.c.