MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / sqrtf

Function sqrtf

include/std/math.h:16–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15#if __MWERKS__ > 0x2301
16extern inline float sqrtf(float x)
17{
18 static const double _half = .5f;
19 static const double _three = 3.0f;
20 if (x > 0.0f)
21 {
22 double xd = (double)x;
23 double guess = __frsqrte(xd); // returns an approximation to
24 guess = _half * guess * (_three - guess * guess * xd); // now have 12 sig bits
25 guess = _half * guess * (_three - guess * guess * xd); // now have 24 sig bits
26 guess = _half * guess * (_three - guess * guess * xd); // now have 32 sig bits
27 return (float)(xd * guess);
28 }
29 else if (x < 0.0)
30 {
31 return NAN;
32 }
33 else if (isnan(x))
34 {
35 return NAN;
36 }
37 else
38 {
39 return x;
40 }
41}
42#else
43extern inline float sqrtf(float x)
44{

Callers 10

inv_sqrtfFunction · 0.70
normalizeFunction · 0.50
vec.cFile · 0.50
C_VECMagFunction · 0.50
C_VECDistanceFunction · 0.50
C_QUATNormalizeFunction · 0.50
C_QUATExpFunction · 0.50
C_QUATLogNFunction · 0.50
C_QUATMtxFunction · 0.50
xsqrtfastFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected