Compare two values for equality, less-than, or greater-than with a tolerance
- Parameters
-
| left | The left value to compare |
| right | The right value to compare |
| tolerance | The minimum value for being considered equal |
- Returns
0 if the two are equal within tolerance , -1 if left < right , 1 if left > right
- Note
- This is similar to the three-way comparison operator (<=>), but with a tolerance for equality
◆ three_way_compare() [1/3]
| int three_way_compare |
( |
double |
left, |
|
|
double |
right, |
|
|
double |
tolerance = 0.0002 |
|
) |
| |
|
inline |
◆ three_way_compare() [2/3]
| int three_way_compare |
( |
float |
left, |
|
|
float |
right, |
|
|
float |
tolerance = 0.0002f |
|
) |
| |
|
inline |
◆ three_way_compare() [3/3]
| int three_way_compare |
( |
long double |
left, |
|
|
long double |
right, |
|
|
long double |
tolerance = 0.0002l |
|
) |
| |
|
inline |