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.
|
| CHECKASM_API int | checkasm_float_near_abs_eps (float a, float b, float eps) |
| | Compare floats using absolute epsilon tolerance.
|
| 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.
|
| 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.
|
| 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.
|
| 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.
|
| CHECKASM_API int | checkasm_double_near_abs_eps (double a, double b, double eps) |
| | Compare doubles using absolute epsilon tolerance.
|
| 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.
|
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_double_near_abs_eps()
| CHECKASM_API int checkasm_double_near_abs_eps |
( |
double | a, |
|
|
double | b, |
|
|
double | 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
◆ checkasm_double_near_abs_eps_array()
| 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.
- 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
◆ checkasm_float_near_abs_eps()
| CHECKASM_API int checkasm_float_near_abs_eps |
( |
float | a, |
|
|
float | b, |
|
|
float | 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
◆ checkasm_float_near_abs_eps_array()
| 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.
- 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
◆ checkasm_float_near_abs_eps_array_ulp()
| 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.
- 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
◆ checkasm_float_near_abs_eps_ulp()
| 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.
- 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
◆ checkasm_float_near_ulp()
| CHECKASM_API int checkasm_float_near_ulp |
( |
float | a, |
|
|
float | b, |
|
|
unsigned | max_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
◆ 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