benilla-re systems structs docs

QuadraticRoots

function · fastmath · primitive

Address
0x454f40 · 140 bytes, up to 0x454fcb
Signature
bool __fastcall (float *t1, float *t2, float a, float b, float c)
Meaning
Stores the smaller and larger root of a quadratic as floats and returns whether it has two
Confidence
verified, proof one
Finding
fastmath#quadratic-solver
Test
fastmath::quadratic_roots_difftest

Finding: Quadratic solver in fastmath

0x454f40(a, b, c) takes three floats, with ecx = &t1 and edx = &t2, and returns in al whether a·t² + b·t + c has two roots: 0, leaving t1 and t2 untouched, when b·b <= (a·c)·4 or either is NaN. Otherwise q = √(b² − 4ac), s = (b > 0 ? b + q : b − q)·(−0.5), inv = 1/(a·s), the roots are (inv·s)·s, kept wide, and f32(f32(inv)·a·c), and the smaller goes to t1, the larger to t2, both as floats. A tie or a NaN wide root puts the wide root in t2.

The derivation is in the doc.

Callers 1

Callees 0

None by a direct call or jump.

Calls and jumps by a bare address, from tables/calls.tsv.