\[0 \leq x \land x \leq 0.5\]
\[\cos^{-1} \left(1 - x\right)
\]
↓
\[\begin{array}{l}
t_0 := \left(\pi \cdot 0.5\right) \cdot \sqrt{\pi \cdot 0.5}\\
t_1 := \sin^{-1} \left(1 - x\right)\\
t_2 := {t_1}^{2}\\
t_3 := \sqrt{t_1}\\
t_4 := t_3 \cdot t_2\\
\frac{\mathsf{fma}\left(t_0, t_0, t_4 \cdot \left(-t_3\right)\right) + \mathsf{fma}\left(t_3 \cdot \left(-t_2\right), t_3, t_3 \cdot t_4\right)}{\left(\pi \cdot \pi\right) \cdot 0.25 + t_1 \cdot \mathsf{fma}\left(\pi, 0.5, t_1\right)}
\end{array}
\]
(FPCore (x) :precision binary64 (acos (- 1.0 x)))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (* (* PI 0.5) (sqrt (* PI 0.5))))
(t_1 (asin (- 1.0 x)))
(t_2 (pow t_1 2.0))
(t_3 (sqrt t_1))
(t_4 (* t_3 t_2)))
(/
(+ (fma t_0 t_0 (* t_4 (- t_3))) (fma (* t_3 (- t_2)) t_3 (* t_3 t_4)))
(+ (* (* PI PI) 0.25) (* t_1 (fma PI 0.5 t_1))))))double code(double x) {
return acos((1.0 - x));
}
↓
double code(double x) {
double t_0 = (((double) M_PI) * 0.5) * sqrt((((double) M_PI) * 0.5));
double t_1 = asin((1.0 - x));
double t_2 = pow(t_1, 2.0);
double t_3 = sqrt(t_1);
double t_4 = t_3 * t_2;
return (fma(t_0, t_0, (t_4 * -t_3)) + fma((t_3 * -t_2), t_3, (t_3 * t_4))) / (((((double) M_PI) * ((double) M_PI)) * 0.25) + (t_1 * fma(((double) M_PI), 0.5, t_1)));
}
function code(x)
return acos(Float64(1.0 - x))
end
↓
function code(x)
t_0 = Float64(Float64(pi * 0.5) * sqrt(Float64(pi * 0.5)))
t_1 = asin(Float64(1.0 - x))
t_2 = t_1 ^ 2.0
t_3 = sqrt(t_1)
t_4 = Float64(t_3 * t_2)
return Float64(Float64(fma(t_0, t_0, Float64(t_4 * Float64(-t_3))) + fma(Float64(t_3 * Float64(-t_2)), t_3, Float64(t_3 * t_4))) / Float64(Float64(Float64(pi * pi) * 0.25) + Float64(t_1 * fma(pi, 0.5, t_1))))
end
code[x_] := N[ArcCos[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[(N[(Pi * 0.5), $MachinePrecision] * N[Sqrt[N[(Pi * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcSin[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[t$95$1], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * t$95$2), $MachinePrecision]}, N[(N[(N[(t$95$0 * t$95$0 + N[(t$95$4 * (-t$95$3)), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 * (-t$95$2)), $MachinePrecision] * t$95$3 + N[(t$95$3 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(Pi * Pi), $MachinePrecision] * 0.25), $MachinePrecision] + N[(t$95$1 * N[(Pi * 0.5 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\cos^{-1} \left(1 - x\right)
↓
\begin{array}{l}
t_0 := \left(\pi \cdot 0.5\right) \cdot \sqrt{\pi \cdot 0.5}\\
t_1 := \sin^{-1} \left(1 - x\right)\\
t_2 := {t_1}^{2}\\
t_3 := \sqrt{t_1}\\
t_4 := t_3 \cdot t_2\\
\frac{\mathsf{fma}\left(t_0, t_0, t_4 \cdot \left(-t_3\right)\right) + \mathsf{fma}\left(t_3 \cdot \left(-t_2\right), t_3, t_3 \cdot t_4\right)}{\left(\pi \cdot \pi\right) \cdot 0.25 + t_1 \cdot \mathsf{fma}\left(\pi, 0.5, t_1\right)}
\end{array}
Alternatives
| Alternative 1 |
|---|
| Accuracy | 10.7% |
|---|
| Cost | 150080 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{{\left(\pi \cdot 0.5\right)}^{3}}\\
t_1 := \sin^{-1} \left(1 - x\right)\\
t_2 := {t_1}^{2}\\
\frac{\mathsf{fma}\left(t_0, t_0, t_1 \cdot \left(-t_2\right)\right) + \mathsf{fma}\left(-t_1, t_2, t_1 \cdot t_2\right)}{\left(\pi \cdot \pi\right) \cdot 0.25 + t_1 \cdot \mathsf{fma}\left(\pi, 0.5, t_1\right)}
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 10.6% |
|---|
| Cost | 52032 |
|---|
\[\begin{array}{l}
t_0 := {\left(\pi \cdot 0.5\right)}^{0.25}\\
\mathsf{fma}\left(t_0, \sqrt{\pi \cdot 0.5} \cdot t_0, -\sin^{-1} \left(1 - x\right)\right)
\end{array}
\]
| Alternative 3 |
|---|
| Accuracy | 10.6% |
|---|
| Cost | 51776 |
|---|
\[\mathsf{fma}\left(\sqrt[3]{0.25 \cdot {\pi}^{2}}, \sqrt[3]{\pi} \cdot \sqrt[3]{0.5}, -\sin^{-1} \left(1 - x\right)\right)
\]
| Alternative 4 |
|---|
| Accuracy | 10.6% |
|---|
| Cost | 51776 |
|---|
\[\mathsf{fma}\left(\sqrt[3]{0.25 \cdot {\pi}^{2}} \cdot \sqrt[3]{\pi}, \sqrt[3]{0.5}, -\sin^{-1} \left(1 - x\right)\right)
\]
| Alternative 5 |
|---|
| Accuracy | 10.6% |
|---|
| Cost | 26496 |
|---|
\[\pi \cdot 0.5 - 3 \cdot \log \left(e^{3 \cdot \left(0.3333333333333333 \cdot \left(\sin^{-1} \left(1 - x\right) \cdot 0.3333333333333333\right)\right)}\right)
\]
| Alternative 6 |
|---|
| Accuracy | 9.7% |
|---|
| Cost | 19844 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\cos^{-1} \left(1 - x\right) \leq 0:\\
\;\;\;\;\pi \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot 0.5 - \sin^{-1} \left(1 - x\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Accuracy | 10.6% |
|---|
| Cost | 19712 |
|---|
\[\mathsf{fma}\left(\sin^{-1} \left(1 - x\right) \cdot 0.3333333333333333, -3, \pi \cdot 0.5\right)
\]
| Alternative 8 |
|---|
| Accuracy | 9.7% |
|---|
| Cost | 13252 |
|---|
\[\begin{array}{l}
t_0 := \cos^{-1} \left(1 - x\right)\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\pi \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 9 |
|---|
| Accuracy | 7.1% |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;1 - x \leq 1:\\
\;\;\;\;1 + \left(\cos^{-1} \left(1 - x\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot 0.5\\
\end{array}
\]
| Alternative 10 |
|---|
| Accuracy | 7.0% |
|---|
| Cost | 6528 |
|---|
\[\pi \cdot 0.5
\]