Compare floating point numbers match within a tolerance.
More...
|
int | fuzzcmp (double a, double b, double delta) |
|
int | fuzzcmpf (float a, float b, float delta) |
|
int | fuzzcmpe (double a, double b, double e) |
|
int | fuzzcmpef (float a, float b, float e) |
|
int | fuzzcmpb (double a, double b, int bits) |
|
int | fuzzcmpbf (float a, float b, int bits) |
|
Compare floating point numbers match within a tolerance.
The tolerance can be specified in absolute terms or it can be relative to the magnitude of the numbers being compared.
#define asserteq |
( |
|
a, |
|
|
|
b |
|
) |
| assert(fuzzcmp(a, b, 1.000010)) |
Assert two values are approximately equal.
Currently this checks the values differ by no more than 10 parts per million.
Definition at line 65 of file fuzz.h.
int fuzzcmp |
( |
double |
a, |
|
|
double |
b, |
|
|
double |
delta |
|
) |
| |
Test whether two values are equal to within a relative tolerance.
- Returns
- True, if a and b are approximately equal.
Definition at line 21 of file fuzz.c.
int fuzzcmpb |
( |
double |
a, |
|
|
double |
b, |
|
|
int |
bits |
|
) |
| |
Test whether two values are equal within the first N bits.
Definition at line 73 of file fuzz.c.
int fuzzcmpbf |
( |
float |
a, |
|
|
float |
b, |
|
|
int |
bits |
|
) |
| |
Single precision equivalence test within the first N bits.
Definition at line 79 of file fuzz.c.
int fuzzcmpe |
( |
double |
a, |
|
|
double |
b, |
|
|
double |
e |
|
) |
| |
Test whether two values are equal to within an absolute tolerance.
Definition at line 61 of file fuzz.c.
int fuzzcmpef |
( |
float |
a, |
|
|
float |
b, |
|
|
float |
e |
|
) |
| |
Single precision equivalence test using an absolute tolerance.
See fuzzcmpe
Definition at line 67 of file fuzz.c.
int fuzzcmpf |
( |
float |
a, |
|
|
float |
b, |
|
|
float |
delta |
|
) |
| |
Single precision equivalence test using a relative tolerance.
See fuzzcmp
Definition at line 41 of file fuzz.c.