diff options
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/functions.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/math/functions.h b/src/math/functions.h index b44a4e5..16de778 100644 --- a/src/math/functions.h +++ b/src/math/functions.h @@ -55,6 +55,12 @@ inline void clamp(float &value, float min=0.0f, float max=1.0f) if (value < min) value = min; else if (value > max) value = max; } +/// return the absolute value of a float +inline float absf(float f) +{ + if (f >0) return f; else return -f; +} + } // namespace math #endif // __INCLUDED_MATH_FUNCTIONS_H__ |