MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / SqrtF

Function SqrtF

rEFIt_UEFI/libeg/FloatLib.cpp:16–43  ·  view source on GitHub ↗

we will assume sqrt(abs(x))

Source from the content-addressed store, hash-verified

14
15//we will assume sqrt(abs(x))
16float SqrtF(float X)
17{
18 /*
19 struct FloatInt {
20 union {
21 INT32 i;
22 float f;
23 } fi;
24 };
25 */
26 if (X == 0.0f) {
27 return 0.0f;
28 } else if (X < 0.0f) {
29 X = -X;
30 }
31// struct FloatInt Y;
32 float Yf;
33 Yf = X * 0.3f;
34// Y.i = Y.i >> 1; // dirty hack - first iteration
35 //do six iterations
36 Yf = Yf * 0.5f + X / (Yf * 2.0f);
37 Yf = Yf * 0.5f + X / (Yf * 2.0f);
38 Yf = Yf * 0.5f + X / (Yf * 2.0f);
39 Yf = Yf * 0.5f + X / (Yf * 2.0f);
40 Yf = Yf * 0.5f + X / (Yf * 2.0f);
41 Yf = Yf * 0.5f + X / (Yf * 2.0f);
42 return Yf;
43}
44
45float CosF(float X);
46

Callers 3

AcosFFunction · 0.85
nsvg__normalizeFunction · 0.85
testSVGFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected