\[0 \leq x \land x \leq 0.5\]
Math FPCore C Julia Wolfram TeX \[\cos^{-1} \left(1 - x\right)
\]
↓
\[\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
t_1 := {\left(\sqrt[3]{t_0}\right)}^{2}\\
t_2 := {t_0}^{0.16666666666666666}\\
t_3 := -t_2\\
t_4 := t_2 \cdot t_1\\
\mathsf{fma}\left(\sqrt[3]{{\pi}^{2} \cdot 0.25}, \sqrt[3]{\pi \cdot 0.5}, t_2 \cdot \left(t_1 \cdot t_3\right)\right) + \mathsf{fma}\left(t_3, t_4, t_2 \cdot t_4\right)
\end{array}
\]
(FPCore (x) :precision binary64 (acos (- 1.0 x))) ↓
(FPCore (x)
:precision binary64
(let* ((t_0 (asin (- 1.0 x)))
(t_1 (pow (cbrt t_0) 2.0))
(t_2 (pow t_0 0.16666666666666666))
(t_3 (- t_2))
(t_4 (* t_2 t_1)))
(+
(fma (cbrt (* (pow PI 2.0) 0.25)) (cbrt (* PI 0.5)) (* t_2 (* t_1 t_3)))
(fma t_3 t_4 (* t_2 t_4))))) double code(double x) {
return acos((1.0 - x));
}
↓
double code(double x) {
double t_0 = asin((1.0 - x));
double t_1 = pow(cbrt(t_0), 2.0);
double t_2 = pow(t_0, 0.16666666666666666);
double t_3 = -t_2;
double t_4 = t_2 * t_1;
return fma(cbrt((pow(((double) M_PI), 2.0) * 0.25)), cbrt((((double) M_PI) * 0.5)), (t_2 * (t_1 * t_3))) + fma(t_3, t_4, (t_2 * t_4));
}
function code(x)
return acos(Float64(1.0 - x))
end
↓
function code(x)
t_0 = asin(Float64(1.0 - x))
t_1 = cbrt(t_0) ^ 2.0
t_2 = t_0 ^ 0.16666666666666666
t_3 = Float64(-t_2)
t_4 = Float64(t_2 * t_1)
return Float64(fma(cbrt(Float64((pi ^ 2.0) * 0.25)), cbrt(Float64(pi * 0.5)), Float64(t_2 * Float64(t_1 * t_3))) + fma(t_3, t_4, Float64(t_2 * t_4)))
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, 1/3], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$0, 0.16666666666666666], $MachinePrecision]}, Block[{t$95$3 = (-t$95$2)}, Block[{t$95$4 = N[(t$95$2 * t$95$1), $MachinePrecision]}, N[(N[(N[Power[N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(Pi * 0.5), $MachinePrecision], 1/3], $MachinePrecision] + N[(t$95$2 * N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * t$95$4 + N[(t$95$2 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\cos^{-1} \left(1 - x\right)
↓
\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
t_1 := {\left(\sqrt[3]{t_0}\right)}^{2}\\
t_2 := {t_0}^{0.16666666666666666}\\
t_3 := -t_2\\
t_4 := t_2 \cdot t_1\\
\mathsf{fma}\left(\sqrt[3]{{\pi}^{2} \cdot 0.25}, \sqrt[3]{\pi \cdot 0.5}, t_2 \cdot \left(t_1 \cdot t_3\right)\right) + \mathsf{fma}\left(t_3, t_4, t_2 \cdot t_4\right)
\end{array}
Alternatives Alternative 1 Accuracy 10.7% Cost 175872
\[\begin{array}{l}
t_0 := \sqrt{\pi \cdot 0.5}\\
t_1 := \sin^{-1} \left(1 - x\right)\\
t_2 := {t_1}^{0.16666666666666666}\\
t_3 := -t_2\\
t_4 := {\left(\sqrt[3]{t_1}\right)}^{2}\\
t_5 := t_2 \cdot t_4\\
\mathsf{fma}\left(t_3, t_5, t_2 \cdot t_5\right) + \mathsf{fma}\left(t_0, t_0, t_2 \cdot \left(t_4 \cdot t_3\right)\right)
\end{array}
\]
Alternative 2 Accuracy 10.7% Cost 45312
\[\mathsf{fma}\left(\sqrt{\pi} \cdot \sqrt{0.5}, \sqrt{\pi \cdot 0.5}, -\sin^{-1} \left(1 - x\right)\right)
\]
Alternative 3 Accuracy 10.6% Cost 39488
\[\begin{array}{l}
t_0 := \sin^{-1} \left(1 - x\right)\\
\cos^{-1} \left(1 - x\right) + \left({t_0}^{0.16666666666666666} \cdot {t_0}^{0.8333333333333334} - t_0\right)
\end{array}
\]
Alternative 4 Accuracy 10.6% Cost 32512
\[\log \left({\left(\sqrt{1 + e^{\cos^{-1} \left(1 - x\right)}}\right)}^{2} + -1\right)
\]
Alternative 5 Accuracy 10.6% Cost 26048
\[\pi \cdot {\left(\sqrt{0.5}\right)}^{2} - \sin^{-1} \left(1 - x\right)
\]
Alternative 6 Accuracy 7.1% Cost 19972
\[\begin{array}{l}
t_0 := \cos^{-1} \left(1 - x\right)\\
\mathbf{if}\;1 - x \leq 1:\\
\;\;\;\;\log \left(\left(1 + e^{t_0}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \sqrt{{\left(t_0 + -1\right)}^{2}}\\
\end{array}
\]
Alternative 7 Accuracy 7.1% Cost 19908
\[\begin{array}{l}
\mathbf{if}\;1 - x \leq 1:\\
\;\;\;\;e^{\log \left(-1 + \left(1 + \cos^{-1} \left(1 - x\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot 0.5 + \sin^{-1} \left(1 - x\right)\\
\end{array}
\]
Alternative 8 Accuracy 7.1% Cost 19908
\[\begin{array}{l}
\mathbf{if}\;1 - x \leq 1:\\
\;\;\;\;\log \left(\left(1 + e^{\cos^{-1} \left(1 - x\right)}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot 0.5 + \sin^{-1} \left(1 - x\right)\\
\end{array}
\]
Alternative 9 Accuracy 7.1% Cost 13444
\[\begin{array}{l}
\mathbf{if}\;1 - x \leq 1:\\
\;\;\;\;-1 + \left(1 + \cos^{-1} \left(1 - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\pi \cdot 0.5 + \sin^{-1} \left(1 - x\right)\\
\end{array}
\]
Alternative 10 Accuracy 7.1% Cost 6848
\[-1 + \left(1 + \cos^{-1} \left(1 - x\right)\right)
\]
Alternative 11 Accuracy 7.1% Cost 6592
\[\cos^{-1} \left(1 - x\right)
\]