5 PL_ALWAYS_INLINE
bool IsFinite(
double value)
12 return ((i2f.i & 0x7FF0000000000000ull) != 0x7FF0000000000000ull);
15 PL_ALWAYS_INLINE
bool IsNaN(
double value)
22 return (((i2f.i & 0x7FF0000000000000ull) == 0x7FF0000000000000ull) && ((i2f.i & 0xFFFFFFFFFFFFFull) != 0));
25 PL_ALWAYS_INLINE
double Floor(
double f)
30 PL_ALWAYS_INLINE
double Ceil(
double f)
35 PL_ALWAYS_INLINE
double Round(
double f)
37 return Floor(f + 0.5f);
42 double fDivides = f / fMultiple;
43 double fFactor = Floor(fDivides);
44 return fFactor * fMultiple;
47 inline double RoundUp(
double f,
double fMultiple)
49 double fDivides = f / fMultiple;
50 double fFactor = Ceil(fDivides);
51 return fFactor * fMultiple;
56 return Round(f / fMultiple) * fMultiple;
59 PL_ALWAYS_INLINE
double Exp(
double f)
64 PL_ALWAYS_INLINE
double Ln(
double f)
69 PL_ALWAYS_INLINE
double Log2(
double f)
71 return log10(f) / log10(2.0);
74 PL_ALWAYS_INLINE
double Log10(
double f)
79 PL_ALWAYS_INLINE
double Log(
double fBase,
double f)
81 return log10(f) / log10(fBase);
84 PL_ALWAYS_INLINE
double Pow2(
double f)
89 PL_ALWAYS_INLINE
double Pow(
double fBase,
double fExp)
91 return pow(fBase, fExp);
94 PL_ALWAYS_INLINE
double Root(
double f,
double fNthRoot)
96 return pow(f, 1.0 / fNthRoot);
99 PL_ALWAYS_INLINE
double Sqrt(
double f)
104 PL_ALWAYS_INLINE
double Mod(
double f,
double fDiv)
106 return fmod(f, fDiv);
This namespace provides common math-functionality as functions.
Definition Constants.h:6
double RoundDown(double f, double fMultiple)
Returns a multiple of fMultiple that is smaller than f.
Definition MathDouble_inl.h:40
PL_ALWAYS_INLINE double RoundToMultiple(double f, double fMultiple)
Rounds f to the closest value of multiple.
Definition MathDouble_inl.h:54
PL_ALWAYS_INLINE double Round(double f)
Rounds f to the next integer.
Definition MathDouble_inl.h:35
double RoundUp(double f, double fMultiple)
Returns a multiple of fMultiple that is larger than f.
Definition MathDouble_inl.h:47
PL_ALWAYS_INLINE double Mod(double f, double fDiv)
Returns "value mod div" for doubles. This also works with negative numbers, both for value and for di...
Definition MathDouble_inl.h:104
PL_ALWAYS_INLINE double Sqrt(double f)
Returns the square root of f.
Definition MathDouble_inl.h:99
Simple helper union to store ints and doubles to modify their bit patterns.
Definition Declarations.h:35