checkasm 1.0.1
Assembly testing and benchmarking framework
Loading...
Searching...
No Matches
Floating-Point Comparison

Utilities for comparing floating-point values with tolerance. More...

Functions

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.

Detailed Description

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.

Function Documentation

◆ 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]aFirst value
[in]bSecond value
[in]epsMaximum 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]aFirst array
[in]bSecond array
[in]epsMaximum acceptable absolute difference per element
[in]lenNumber 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]aFirst value
[in]bSecond value
[in]epsMaximum 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]aFirst array
[in]bSecond array
[in]epsMaximum acceptable absolute difference per element
[in]lenNumber 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]aFirst array
[in]bSecond array
[in]epsMaximum acceptable absolute difference per element
[in]max_ulpMaximum acceptable ULP distance
[in]lenNumber 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]aFirst value
[in]bSecond value
[in]epsMaximum acceptable absolute difference
[in]max_ulpMaximum 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]aFirst value
[in]bSecond value
[in]max_ulpMaximum 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]aFirst array
[in]bSecond array
[in]max_ulpMaximum acceptable ULP distance
[in]lenNumber of elements to compare
Returns
Non-zero if all elements are within tolerance, 0 otherwise