Created
January 22, 2013 16:43
-
-
Save dbrockman/4596152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Takes a number and clamps it to within the provided bounds. | |
#define Clamp(_num, _min, _max) MIN((_max), MAX((_min), (_num))) | |
// Check if the two floats are equal. | |
#define FloatEqual(A, B) (ABS((A) - (B)) < FLT_EPSILON) | |
// Check if the two floats are NOT equal. | |
#define FloatNotEqual(A, B) (ABS((A) - (B)) > FLT_EPSILON) | |
// Check if the float is equal to zero. | |
#define FloatIsZero(A) (ABS(A) < FLT_EPSILON) | |
// Check if the float is NOT equal to zero. | |
#define FloatNotZero(A) (ABS(A) > FLT_EPSILON) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment