28 get_nearly_zero_value(
double) {
33 get_nearly_zero_value(
float) {
38 get_nearly_zero_value(
int) {
47 #define IS_THRESHOLD_ZERO(value, threshold) \ 48 ((value) < (threshold) && (value) > -(threshold)) 52 #define IS_THRESHOLD_EQUAL(value1, value2, threshold) \ 53 (IS_THRESHOLD_ZERO((value1) - (value2), threshold)) 59 #define IS_THRESHOLD_COMPEQ(value1, value2, threshold) \ 60 (cfloor(value1 / threshold + 0.5f) == cfloor(value2 / threshold + 0.5f)) 65 #define NEARLY_ZERO(FLOATTYPE) (get_nearly_zero_value((FLOATTYPE)0)) 68 #define IS_NEARLY_ZERO(value) \ 69 (IS_THRESHOLD_ZERO(value, get_nearly_zero_value(value))) 73 #define IS_NEARLY_EQUAL(value1, value2) \ 74 (IS_THRESHOLD_EQUAL(value1, value2, get_nearly_zero_value(value1))) 79 #define MAYBE_ZERO(value) \ 80 (IS_NEARLY_ZERO(value) ? 0 : (value))