\[0 \leq x \land x \leq 0.5\]
\[\cos^{-1} \left(1 - x\right)
\]
↓
\[\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
t_1 := {\left({t_0}^{0.16666666666666666}\right)}^{3}\\
\frac{\mathsf{fma}\left(\sqrt[3]{{\left(\pi \cdot 0.5\right)}^{4}}, \sqrt[3]{0.25 \cdot {\pi}^{2}}, -{t_0}^{2}\right)}{\pi \cdot 0.5 + t_1 \cdot t_1}
\end{array}
\]
(FPCore (x) :precision binary64 (acos (- 1.0 x)))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (asin (- 1.0 x))) (t_1 (pow (pow t_0 0.16666666666666666) 3.0)))
(/
(fma
(cbrt (pow (* PI 0.5) 4.0))
(cbrt (* 0.25 (pow PI 2.0)))
(- (pow t_0 2.0)))
(+ (* PI 0.5) (* t_1 t_1)))))double code(double x) {
return acos((1.0 - x));
}
↓
double code(double x) {
double t_0 = asin((1.0 - x));
double t_1 = pow(pow(t_0, 0.16666666666666666), 3.0);
return fma(cbrt(pow((((double) M_PI) * 0.5), 4.0)), cbrt((0.25 * pow(((double) M_PI), 2.0))), -pow(t_0, 2.0)) / ((((double) M_PI) * 0.5) + (t_1 * t_1));
}
function code(x)
return acos(Float64(1.0 - x))
end
↓
function code(x)
t_0 = asin(Float64(1.0 - x))
t_1 = (t_0 ^ 0.16666666666666666) ^ 3.0
return Float64(fma(cbrt((Float64(pi * 0.5) ^ 4.0)), cbrt(Float64(0.25 * (pi ^ 2.0))), Float64(-(t_0 ^ 2.0))) / Float64(Float64(pi * 0.5) + Float64(t_1 * t_1)))
end
code[x_] := N[ArcCos[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Power[t$95$0, 0.16666666666666666], $MachinePrecision], 3.0], $MachinePrecision]}, N[(N[(N[Power[N[Power[N[(Pi * 0.5), $MachinePrecision], 4.0], $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(0.25 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + (-N[Power[t$95$0, 2.0], $MachinePrecision])), $MachinePrecision] / N[(N[(Pi * 0.5), $MachinePrecision] + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\cos^{-1} \left(1 - x\right)
↓
\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
t_1 := {\left({t_0}^{0.16666666666666666}\right)}^{3}\\
\frac{\mathsf{fma}\left(\sqrt[3]{{\left(\pi \cdot 0.5\right)}^{4}}, \sqrt[3]{0.25 \cdot {\pi}^{2}}, -{t_0}^{2}\right)}{\pi \cdot 0.5 + t_1 \cdot t_1}
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 57.3 |
|---|
| Cost | 84416 |
|---|
\[\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
\frac{\mathsf{fma}\left(\sqrt[3]{{\left(\pi \cdot 0.5\right)}^{4}}, \sqrt[3]{0.25 \cdot {\pi}^{2}}, -{t_0}^{2}\right)}{\pi \cdot 0.5 + {\left(\sqrt[3]{t_0}\right)}^{3}}
\end{array}
\]
| Alternative 2 |
|---|
| Error | 57.3 |
|---|
| Cost | 71552 |
|---|
\[\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
\frac{\mathsf{fma}\left(\sqrt[3]{{\left(\pi \cdot 0.5\right)}^{4}}, \sqrt[3]{0.25 \cdot {\pi}^{2}}, -{t_0}^{2}\right)}{\pi \cdot 0.5 + t_0}
\end{array}
\]
| Alternative 3 |
|---|
| Error | 57.3 |
|---|
| Cost | 19712 |
|---|
\[3 \cdot \mathsf{fma}\left(\pi, 0.16666666666666666, \sin^{-1} \left(1 - x\right) \cdot -0.3333333333333333\right)
\]
| Alternative 4 |
|---|
| Error | 59.6 |
|---|
| Cost | 13700 |
|---|
\[\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
\mathbf{if}\;1 - x \leq 1:\\
\;\;\;\;\left(\pi \cdot 0.5 + 1\right) - \left(1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot t_0 + \cos^{-1} \left(1 - x\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 57.9 |
|---|
| Cost | 13508 |
|---|
\[\begin{array}{l}
t_0 := \cos^{-1} \left(1 - x\right)\\
\mathbf{if}\;x \leq 5.5 \cdot 10^{-17}:\\
\;\;\;\;2 \cdot \sin^{-1} \left(1 - x\right) + t_0\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(-1 + \left(2 + \left(-1 + \left(1 + t_0\right)\right)\right)\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 59.6 |
|---|
| Cost | 7232 |
|---|
\[-1 + \left(-1 + \left(2 + \left(-1 + \left(1 + \cos^{-1} \left(1 - x\right)\right)\right)\right)\right)
\]
| Alternative 7 |
|---|
| Error | 59.6 |
|---|
| Cost | 6848 |
|---|
\[1 + \left(-1 + \cos^{-1} \left(1 - x\right)\right)
\]
| Alternative 8 |
|---|
| Error | 59.6 |
|---|
| Cost | 6848 |
|---|
\[-1 + \left(1 + \cos^{-1} \left(1 - x\right)\right)
\]
| Alternative 9 |
|---|
| Error | 59.6 |
|---|
| Cost | 6592 |
|---|
\[\cos^{-1} \left(1 - x\right)
\]