18 #include "precompiled.h"
36 const char* c = &s[0];
51 if (*c >=
'0' && *c <=
'9')
63 while (*c >=
'0' && *c <=
'9')
86 return (neg ? -r : r);
121 u32 digit = (((
u64)fraction*div) >> 16) - frac;
125 if (((
u64)frac << 16) / div == fraction)
132 if (digit <= 8 && (((
u64)frac+1) << 16) / div == fraction)
A simple fixed-point number class.
CFixed_15_16 fixed
Default fixed-point type used by the engine.
void SetInternalValue(T n)
CFixed< i32,(i32) 0x7fffffff, 32, 15, 16, 65536 > CFixed_15_16
A fixed-point number class with 1-bit sign, 15-bit integral part, 16-bit fractional part...
CFixed Multiply(CFixed n) const
Multiply by a CFixed.
static CFixed FromString(const CStr8 &s)
static CFixed FromInt(int n)
bool IsZero() const
Returns true if the number is precisely 0.
CStr8 ToString() const
Returns the shortest string such that FromString will parse to the correct value. ...
void sincos_approx(CFixed_15_16 a, CFixed_15_16 &sin_out, CFixed_15_16 &cos_out)
Compute sin(a) and cos(a).
CFixed_15_16 atan2_approx(CFixed_15_16 y, CFixed_15_16 x)
Inaccurate approximation of atan2 over fixed-point numbers.