C-libs 0.1.0
Some C utils libraries
 
Loading...
Searching...
No Matches
Point Utilities

Macros

#define PI   3.14159265358979323846
 
#define DEG2RAD(deg)
 
#define RAD2DEG(rad)
 
#define IS_NAN(x)
 
#define FLOAT_EPSILON   (1e-6f)
 
#define DOUBLE_EPSILON   (1e-12)
 
#define ROUND(x)
 
#define FLOOR(x)
 
#define CEIL(x)
 
#define FLOAT_ABS(x)
 
#define FLOAT_ALMOST_EQUALS(x, y)
 
#define DOUBLE_ALMOST_EQUALS(x, y)
 
#define FLOAT_RELATIVE_EQUAL(x, y)
 
#define DOUBLE_RELATIVE_EQUAL(x, y)
 

Detailed Description

Macros for comparing and rounding floating point numbers.

Macro Definition Documentation

◆ CEIL

#define CEIL ( x)
Value:
(((x) == (i64)(x)) ? (i64)(x) : (((x) < 0.0) ? (i64)(x) : ((i64)(x) + 1)))
signed long long int i64
64-bit signed integer
Definition util_macros.h:104

◆ DEG2RAD

#define DEG2RAD ( deg)
Value:
((deg) * (PI) / 180.0)
#define PI
Definition util_macros.h:199

◆ DOUBLE_ALMOST_EQUALS

#define DOUBLE_ALMOST_EQUALS ( x,
y )
Value:
(FLOAT_ABS((x) - (y)) <= DOUBLE_EPSILON)
#define FLOAT_ABS(x)
Definition util_macros.h:213
#define DOUBLE_EPSILON
Definition util_macros.h:206

◆ DOUBLE_EPSILON

#define DOUBLE_EPSILON   (1e-12)

◆ DOUBLE_RELATIVE_EQUAL

#define DOUBLE_RELATIVE_EQUAL ( x,
y )
Value:
(FLOAT_ABS((x) - (y)) <= (DOUBLE_EPSILON * MAX(FLOAT_ABS(x), FLOAT_ABS(y))))
#define MAX(a, b)
Definition util_macros.h:182

◆ FLOAT_ABS

#define FLOAT_ABS ( x)
Value:
(((x) < 0.0) ? -(x) : (x))

◆ FLOAT_ALMOST_EQUALS

#define FLOAT_ALMOST_EQUALS ( x,
y )
Value:
(FLOAT_ABS((x) - (y)) <= FLOAT_EPSILON)
#define FLOAT_EPSILON
Definition util_macros.h:205

◆ FLOAT_EPSILON

#define FLOAT_EPSILON   (1e-6f)

◆ FLOAT_RELATIVE_EQUAL

#define FLOAT_RELATIVE_EQUAL ( x,
y )
Value:
(FLOAT_ABS((x) - (y)) <= (FLOAT_EPSILON * MAX(FLOAT_ABS(x), FLOAT_ABS(y))))

◆ FLOOR

#define FLOOR ( x)
Value:
(((x) < 0.0) ? ((i64)(x) - 1) : ((i64)(x)))

◆ IS_NAN

#define IS_NAN ( x)
Value:
((x) != (x))

◆ PI

#define PI   3.14159265358979323846

◆ RAD2DEG

#define RAD2DEG ( rad)
Value:
((rad) * 180.0 / (PI))

◆ ROUND

#define ROUND ( x)
Value:
(((x) < 0.0) ? ((i64)((x) - 0.5)) : ((i64)((x) + 0.5)))