FastPow2
function · fastmath · primitive
- Address
0x454d40· 196 bytes, up to0x454e03- Signature
double __stdcall (double x)- Meaning
- Returns 2 to the x from a 64-entry table and a degree-5 polynomial, with the exponent set directly
- Confidence
- verified, proof one
- Finding
- fastmath#software-exp2
- Test
fastmath::exp2_diff
Finding: Software exp2 in fastmath
0x454d40(x) (cdecl, ret 8, result in st0) returns 2^x for x from −1021 to 1026.
S = x + 1023.0, n = low32(__ftol(S)) − 1, frac = S − (double)(uint64){n, 0} in [1, 2).
i is the top six mantissa bits of frac; rf is frac with them cleared. The result is
P(rf)·(2^n·T[i]): 2^n is the double with high dword n << 20 and low dword 0, T[i] = 2^(i/64)
is at 0x8029e0, and P(r) = (c0 + r·c1) + ((c2 + r·c3) + (c4 + r·c5)·r²)·r², c0 to c5 the doubles
from 0x803028. For unsigned n > 0x7ff: +∞ if n is positive as an int, else 0.0.
The derivation is in the doc.
Callers 2
- Snow::Update lighting
- BuildSceneFog lighting
Callees 1
- __ftol crt
Calls and jumps by a bare address, from tables/calls.tsv.