
(FPCore (x) :precision binary64 (- (/ PI 2.0) (* 2.0 (asin (sqrt (/ (- 1.0 x) 2.0))))))
double code(double x) {
return (((double) M_PI) / 2.0) - (2.0 * asin(sqrt(((1.0 - x) / 2.0))));
}
public static double code(double x) {
return (Math.PI / 2.0) - (2.0 * Math.asin(Math.sqrt(((1.0 - x) / 2.0))));
}
def code(x): return (math.pi / 2.0) - (2.0 * math.asin(math.sqrt(((1.0 - x) / 2.0))))
function code(x) return Float64(Float64(pi / 2.0) - Float64(2.0 * asin(sqrt(Float64(Float64(1.0 - x) / 2.0))))) end
function tmp = code(x) tmp = (pi / 2.0) - (2.0 * asin(sqrt(((1.0 - x) / 2.0)))); end
code[x_] := N[(N[(Pi / 2.0), $MachinePrecision] - N[(2.0 * N[ArcSin[N[Sqrt[N[(N[(1.0 - x), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1 - x}{2}}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ PI 2.0) (* 2.0 (asin (sqrt (/ (- 1.0 x) 2.0))))))
double code(double x) {
return (((double) M_PI) / 2.0) - (2.0 * asin(sqrt(((1.0 - x) / 2.0))));
}
public static double code(double x) {
return (Math.PI / 2.0) - (2.0 * Math.asin(Math.sqrt(((1.0 - x) / 2.0))));
}
def code(x): return (math.pi / 2.0) - (2.0 * math.asin(math.sqrt(((1.0 - x) / 2.0))))
function code(x) return Float64(Float64(pi / 2.0) - Float64(2.0 * asin(sqrt(Float64(Float64(1.0 - x) / 2.0))))) end
function tmp = code(x) tmp = (pi / 2.0) - (2.0 * asin(sqrt(((1.0 - x) / 2.0)))); end
code[x_] := N[(N[(Pi / 2.0), $MachinePrecision] - N[(2.0 * N[ArcSin[N[Sqrt[N[(N[(1.0 - x), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1 - x}{2}}\right)
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (asin (sqrt (- 0.5 (* 0.5 x)))))
(t_1 (- (* PI 0.5) (acos (sqrt (fma x -0.5 0.5)))))
(t_2 (* (pow t_1 3.0) 8.0))
(t_3 (pow t_1 9.0)))
(/
(/
(/
(fma
(pow (pow PI 9.0) 3.0)
7.450580596923828e-9
(* (pow t_3 3.0) -134217728.0))
(+
(* (pow PI 18.0) 3.814697265625e-6)
(fma (pow PI 9.0) t_3 (* (pow t_1 18.0) 262144.0))))
(+
(* (pow PI 6.0) 0.015625)
(+ (pow t_2 2.0) (* t_2 (* (pow PI 3.0) 0.125)))))
(fma (* 2.0 t_0) (fma 2.0 t_0 (* PI 0.5)) (* (pow PI 2.0) 0.25)))))
double code(double x) {
double t_0 = asin(sqrt((0.5 - (0.5 * x))));
double t_1 = (((double) M_PI) * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)));
double t_2 = pow(t_1, 3.0) * 8.0;
double t_3 = pow(t_1, 9.0);
return ((fma(pow(pow(((double) M_PI), 9.0), 3.0), 7.450580596923828e-9, (pow(t_3, 3.0) * -134217728.0)) / ((pow(((double) M_PI), 18.0) * 3.814697265625e-6) + fma(pow(((double) M_PI), 9.0), t_3, (pow(t_1, 18.0) * 262144.0)))) / ((pow(((double) M_PI), 6.0) * 0.015625) + (pow(t_2, 2.0) + (t_2 * (pow(((double) M_PI), 3.0) * 0.125))))) / fma((2.0 * t_0), fma(2.0, t_0, (((double) M_PI) * 0.5)), (pow(((double) M_PI), 2.0) * 0.25));
}
function code(x) t_0 = asin(sqrt(Float64(0.5 - Float64(0.5 * x)))) t_1 = Float64(Float64(pi * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)))) t_2 = Float64((t_1 ^ 3.0) * 8.0) t_3 = t_1 ^ 9.0 return Float64(Float64(Float64(fma(((pi ^ 9.0) ^ 3.0), 7.450580596923828e-9, Float64((t_3 ^ 3.0) * -134217728.0)) / Float64(Float64((pi ^ 18.0) * 3.814697265625e-6) + fma((pi ^ 9.0), t_3, Float64((t_1 ^ 18.0) * 262144.0)))) / Float64(Float64((pi ^ 6.0) * 0.015625) + Float64((t_2 ^ 2.0) + Float64(t_2 * Float64((pi ^ 3.0) * 0.125))))) / fma(Float64(2.0 * t_0), fma(2.0, t_0, Float64(pi * 0.5)), Float64((pi ^ 2.0) * 0.25))) end
code[x_] := Block[{t$95$0 = N[ArcSin[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[N[Sqrt[N[(x * -0.5 + 0.5), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[t$95$1, 3.0], $MachinePrecision] * 8.0), $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$1, 9.0], $MachinePrecision]}, N[(N[(N[(N[(N[Power[N[Power[Pi, 9.0], $MachinePrecision], 3.0], $MachinePrecision] * 7.450580596923828e-9 + N[(N[Power[t$95$3, 3.0], $MachinePrecision] * -134217728.0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[Pi, 18.0], $MachinePrecision] * 3.814697265625e-6), $MachinePrecision] + N[(N[Power[Pi, 9.0], $MachinePrecision] * t$95$3 + N[(N[Power[t$95$1, 18.0], $MachinePrecision] * 262144.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[Pi, 6.0], $MachinePrecision] * 0.015625), $MachinePrecision] + N[(N[Power[t$95$2, 2.0], $MachinePrecision] + N[(t$95$2 * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(2.0 * t$95$0 + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right)\\
t_1 := \pi \cdot 0.5 - \cos^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)\\
t_2 := {t_1}^{3} \cdot 8\\
t_3 := {t_1}^{9}\\
\frac{\frac{\frac{\mathsf{fma}\left({\left({\pi}^{9}\right)}^{3}, 7.450580596923828 \cdot 10^{-9}, {t_3}^{3} \cdot -134217728\right)}{{\pi}^{18} \cdot 3.814697265625 \cdot 10^{-6} + \mathsf{fma}\left({\pi}^{9}, t_3, {t_1}^{18} \cdot 262144\right)}}{{\pi}^{6} \cdot 0.015625 + \left({t_2}^{2} + t_2 \cdot \left({\pi}^{3} \cdot 0.125\right)\right)}}{\mathsf{fma}\left(2 \cdot t_0, \mathsf{fma}\left(2, t_0, \pi \cdot 0.5\right), {\pi}^{2} \cdot 0.25\right)}
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (asin (sqrt (- 0.5 (* 0.5 x)))))
(t_1 (- (* PI 0.5) (acos (sqrt (fma x -0.5 0.5)))))
(t_2 (* (pow t_1 3.0) 8.0)))
(/
(/
(log (exp (- (* (pow PI 9.0) 0.001953125) (* (pow t_1 9.0) 512.0))))
(+
(* (pow PI 6.0) 0.015625)
(+ (pow t_2 2.0) (* t_2 (* (pow PI 3.0) 0.125)))))
(fma (* 2.0 t_0) (fma 2.0 t_0 (* PI 0.5)) (* (pow PI 2.0) 0.25)))))
double code(double x) {
double t_0 = asin(sqrt((0.5 - (0.5 * x))));
double t_1 = (((double) M_PI) * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)));
double t_2 = pow(t_1, 3.0) * 8.0;
return (log(exp(((pow(((double) M_PI), 9.0) * 0.001953125) - (pow(t_1, 9.0) * 512.0)))) / ((pow(((double) M_PI), 6.0) * 0.015625) + (pow(t_2, 2.0) + (t_2 * (pow(((double) M_PI), 3.0) * 0.125))))) / fma((2.0 * t_0), fma(2.0, t_0, (((double) M_PI) * 0.5)), (pow(((double) M_PI), 2.0) * 0.25));
}
function code(x) t_0 = asin(sqrt(Float64(0.5 - Float64(0.5 * x)))) t_1 = Float64(Float64(pi * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)))) t_2 = Float64((t_1 ^ 3.0) * 8.0) return Float64(Float64(log(exp(Float64(Float64((pi ^ 9.0) * 0.001953125) - Float64((t_1 ^ 9.0) * 512.0)))) / Float64(Float64((pi ^ 6.0) * 0.015625) + Float64((t_2 ^ 2.0) + Float64(t_2 * Float64((pi ^ 3.0) * 0.125))))) / fma(Float64(2.0 * t_0), fma(2.0, t_0, Float64(pi * 0.5)), Float64((pi ^ 2.0) * 0.25))) end
code[x_] := Block[{t$95$0 = N[ArcSin[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[N[Sqrt[N[(x * -0.5 + 0.5), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[t$95$1, 3.0], $MachinePrecision] * 8.0), $MachinePrecision]}, N[(N[(N[Log[N[Exp[N[(N[(N[Power[Pi, 9.0], $MachinePrecision] * 0.001953125), $MachinePrecision] - N[(N[Power[t$95$1, 9.0], $MachinePrecision] * 512.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(N[(N[Power[Pi, 6.0], $MachinePrecision] * 0.015625), $MachinePrecision] + N[(N[Power[t$95$2, 2.0], $MachinePrecision] + N[(t$95$2 * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(2.0 * t$95$0 + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right)\\
t_1 := \pi \cdot 0.5 - \cos^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)\\
t_2 := {t_1}^{3} \cdot 8\\
\frac{\frac{\log \left(e^{{\pi}^{9} \cdot 0.001953125 - {t_1}^{9} \cdot 512}\right)}{{\pi}^{6} \cdot 0.015625 + \left({t_2}^{2} + t_2 \cdot \left({\pi}^{3} \cdot 0.125\right)\right)}}{\mathsf{fma}\left(2 \cdot t_0, \mathsf{fma}\left(2, t_0, \pi \cdot 0.5\right), {\pi}^{2} \cdot 0.25\right)}
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (asin (sqrt (- 0.5 (* 0.5 x)))))
(t_1 (- (* PI 0.5) (acos (sqrt (fma x -0.5 0.5)))))
(t_2 (* (pow t_1 3.0) 8.0)))
(/
(/
(- (* (pow PI 9.0) 0.001953125) (* (pow t_1 9.0) 512.0))
(+
(* (pow PI 6.0) 0.015625)
(+ (pow t_2 2.0) (* t_2 (* (pow PI 3.0) 0.125)))))
(fma (* 2.0 t_0) (fma 2.0 t_0 (* PI 0.5)) (* (pow PI 2.0) 0.25)))))
double code(double x) {
double t_0 = asin(sqrt((0.5 - (0.5 * x))));
double t_1 = (((double) M_PI) * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)));
double t_2 = pow(t_1, 3.0) * 8.0;
return (((pow(((double) M_PI), 9.0) * 0.001953125) - (pow(t_1, 9.0) * 512.0)) / ((pow(((double) M_PI), 6.0) * 0.015625) + (pow(t_2, 2.0) + (t_2 * (pow(((double) M_PI), 3.0) * 0.125))))) / fma((2.0 * t_0), fma(2.0, t_0, (((double) M_PI) * 0.5)), (pow(((double) M_PI), 2.0) * 0.25));
}
function code(x) t_0 = asin(sqrt(Float64(0.5 - Float64(0.5 * x)))) t_1 = Float64(Float64(pi * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)))) t_2 = Float64((t_1 ^ 3.0) * 8.0) return Float64(Float64(Float64(Float64((pi ^ 9.0) * 0.001953125) - Float64((t_1 ^ 9.0) * 512.0)) / Float64(Float64((pi ^ 6.0) * 0.015625) + Float64((t_2 ^ 2.0) + Float64(t_2 * Float64((pi ^ 3.0) * 0.125))))) / fma(Float64(2.0 * t_0), fma(2.0, t_0, Float64(pi * 0.5)), Float64((pi ^ 2.0) * 0.25))) end
code[x_] := Block[{t$95$0 = N[ArcSin[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[N[Sqrt[N[(x * -0.5 + 0.5), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[t$95$1, 3.0], $MachinePrecision] * 8.0), $MachinePrecision]}, N[(N[(N[(N[(N[Power[Pi, 9.0], $MachinePrecision] * 0.001953125), $MachinePrecision] - N[(N[Power[t$95$1, 9.0], $MachinePrecision] * 512.0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[Pi, 6.0], $MachinePrecision] * 0.015625), $MachinePrecision] + N[(N[Power[t$95$2, 2.0], $MachinePrecision] + N[(t$95$2 * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(2.0 * t$95$0 + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right)\\
t_1 := \pi \cdot 0.5 - \cos^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)\\
t_2 := {t_1}^{3} \cdot 8\\
\frac{\frac{{\pi}^{9} \cdot 0.001953125 - {t_1}^{9} \cdot 512}{{\pi}^{6} \cdot 0.015625 + \left({t_2}^{2} + t_2 \cdot \left({\pi}^{3} \cdot 0.125\right)\right)}}{\mathsf{fma}\left(2 \cdot t_0, \mathsf{fma}\left(2, t_0, \pi \cdot 0.5\right), {\pi}^{2} \cdot 0.25\right)}
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (asin (sqrt (- 0.5 (* 0.5 x))))))
(/
(log
(exp
(-
(* (pow PI 3.0) 0.125)
(* (pow (- (* PI 0.5) (acos (sqrt (fma x -0.5 0.5)))) 3.0) 8.0))))
(fma (* 2.0 t_0) (fma 2.0 t_0 (* PI 0.5)) (* (pow PI 2.0) 0.25)))))
double code(double x) {
double t_0 = asin(sqrt((0.5 - (0.5 * x))));
return log(exp(((pow(((double) M_PI), 3.0) * 0.125) - (pow(((((double) M_PI) * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)))), 3.0) * 8.0)))) / fma((2.0 * t_0), fma(2.0, t_0, (((double) M_PI) * 0.5)), (pow(((double) M_PI), 2.0) * 0.25));
}
function code(x) t_0 = asin(sqrt(Float64(0.5 - Float64(0.5 * x)))) return Float64(log(exp(Float64(Float64((pi ^ 3.0) * 0.125) - Float64((Float64(Float64(pi * 0.5) - acos(sqrt(fma(x, -0.5, 0.5)))) ^ 3.0) * 8.0)))) / fma(Float64(2.0 * t_0), fma(2.0, t_0, Float64(pi * 0.5)), Float64((pi ^ 2.0) * 0.25))) end
code[x_] := Block[{t$95$0 = N[ArcSin[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Log[N[Exp[N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.125), $MachinePrecision] - N[(N[Power[N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[N[Sqrt[N[(x * -0.5 + 0.5), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] * 8.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(2.0 * t$95$0 + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right)\\
\frac{\log \left(e^{{\pi}^{3} \cdot 0.125 - {\left(\pi \cdot 0.5 - \cos^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)\right)}^{3} \cdot 8}\right)}{\mathsf{fma}\left(2 \cdot t_0, \mathsf{fma}\left(2, t_0, \pi \cdot 0.5\right), {\pi}^{2} \cdot 0.25\right)}
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (- (* PI 0.5) (acos (sqrt (+ 0.5 (* x -0.5)))))))
(/
(- (* (pow PI 3.0) 0.125) (* 8.0 (pow t_0 3.0)))
(fma
(* 2.0 t_0)
(fma 2.0 (asin (sqrt (- 0.5 (* 0.5 x)))) (* PI 0.5))
(* (pow PI 2.0) 0.25)))))
double code(double x) {
double t_0 = (((double) M_PI) * 0.5) - acos(sqrt((0.5 + (x * -0.5))));
return ((pow(((double) M_PI), 3.0) * 0.125) - (8.0 * pow(t_0, 3.0))) / fma((2.0 * t_0), fma(2.0, asin(sqrt((0.5 - (0.5 * x)))), (((double) M_PI) * 0.5)), (pow(((double) M_PI), 2.0) * 0.25));
}
function code(x) t_0 = Float64(Float64(pi * 0.5) - acos(sqrt(Float64(0.5 + Float64(x * -0.5))))) return Float64(Float64(Float64((pi ^ 3.0) * 0.125) - Float64(8.0 * (t_0 ^ 3.0))) / fma(Float64(2.0 * t_0), fma(2.0, asin(sqrt(Float64(0.5 - Float64(0.5 * x)))), Float64(pi * 0.5)), Float64((pi ^ 2.0) * 0.25))) end
code[x_] := Block[{t$95$0 = N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[N[Sqrt[N[(0.5 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.125), $MachinePrecision] - N[(8.0 * N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(2.0 * N[ArcSin[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot 0.5 - \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)\\
\frac{{\pi}^{3} \cdot 0.125 - 8 \cdot {t_0}^{3}}{\mathsf{fma}\left(2 \cdot t_0, \mathsf{fma}\left(2, \sin^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right), \pi \cdot 0.5\right), {\pi}^{2} \cdot 0.25\right)}
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (asin (sqrt (- 0.5 (* 0.5 x))))))
(/
(-
(* (pow PI 3.0) 0.125)
(* 8.0 (pow (- (* PI 0.5) (acos (sqrt (+ 0.5 (* x -0.5))))) 3.0)))
(fma (* 2.0 t_0) (fma 2.0 t_0 (* PI 0.5)) (* (pow PI 2.0) 0.25)))))
double code(double x) {
double t_0 = asin(sqrt((0.5 - (0.5 * x))));
return ((pow(((double) M_PI), 3.0) * 0.125) - (8.0 * pow(((((double) M_PI) * 0.5) - acos(sqrt((0.5 + (x * -0.5))))), 3.0))) / fma((2.0 * t_0), fma(2.0, t_0, (((double) M_PI) * 0.5)), (pow(((double) M_PI), 2.0) * 0.25));
}
function code(x) t_0 = asin(sqrt(Float64(0.5 - Float64(0.5 * x)))) return Float64(Float64(Float64((pi ^ 3.0) * 0.125) - Float64(8.0 * (Float64(Float64(pi * 0.5) - acos(sqrt(Float64(0.5 + Float64(x * -0.5))))) ^ 3.0))) / fma(Float64(2.0 * t_0), fma(2.0, t_0, Float64(pi * 0.5)), Float64((pi ^ 2.0) * 0.25))) end
code[x_] := Block[{t$95$0 = N[ArcSin[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.125), $MachinePrecision] - N[(8.0 * N[Power[N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[N[Sqrt[N[(0.5 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(2.0 * t$95$0 + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision] + N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right)\\
\frac{{\pi}^{3} \cdot 0.125 - 8 \cdot {\left(\pi \cdot 0.5 - \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)\right)}^{3}}{\mathsf{fma}\left(2 \cdot t_0, \mathsf{fma}\left(2, t_0, \pi \cdot 0.5\right), {\pi}^{2} \cdot 0.25\right)}
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(/
1.0
(/
(fma 2.0 (asin (sqrt (- 0.5 (* 0.5 x)))) (* PI 0.5))
(-
(* (pow PI 2.0) 0.25)
(* (pow (- (* PI 0.5) (acos (sqrt (+ 0.5 (* x -0.5))))) 2.0) 4.0)))))
double code(double x) {
return 1.0 / (fma(2.0, asin(sqrt((0.5 - (0.5 * x)))), (((double) M_PI) * 0.5)) / ((pow(((double) M_PI), 2.0) * 0.25) - (pow(((((double) M_PI) * 0.5) - acos(sqrt((0.5 + (x * -0.5))))), 2.0) * 4.0)));
}
function code(x) return Float64(1.0 / Float64(fma(2.0, asin(sqrt(Float64(0.5 - Float64(0.5 * x)))), Float64(pi * 0.5)) / Float64(Float64((pi ^ 2.0) * 0.25) - Float64((Float64(Float64(pi * 0.5) - acos(sqrt(Float64(0.5 + Float64(x * -0.5))))) ^ 2.0) * 4.0)))) end
code[x_] := N[(1.0 / N[(N[(2.0 * N[ArcSin[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Power[Pi, 2.0], $MachinePrecision] * 0.25), $MachinePrecision] - N[(N[Power[N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[N[Sqrt[N[(0.5 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{\mathsf{fma}\left(2, \sin^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right), \pi \cdot 0.5\right)}{{\pi}^{2} \cdot 0.25 - {\left(\pi \cdot 0.5 - \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)\right)}^{2} \cdot 4}}
\end{array}
(FPCore (x) :precision binary64 (+ (/ PI 2.0) (* 2.0 (- (acos (sqrt (- 0.5 (* 0.5 x)))) (* PI 0.5)))))
double code(double x) {
return (((double) M_PI) / 2.0) + (2.0 * (acos(sqrt((0.5 - (0.5 * x)))) - (((double) M_PI) * 0.5)));
}
public static double code(double x) {
return (Math.PI / 2.0) + (2.0 * (Math.acos(Math.sqrt((0.5 - (0.5 * x)))) - (Math.PI * 0.5)));
}
def code(x): return (math.pi / 2.0) + (2.0 * (math.acos(math.sqrt((0.5 - (0.5 * x)))) - (math.pi * 0.5)))
function code(x) return Float64(Float64(pi / 2.0) + Float64(2.0 * Float64(acos(sqrt(Float64(0.5 - Float64(0.5 * x)))) - Float64(pi * 0.5)))) end
function tmp = code(x) tmp = (pi / 2.0) + (2.0 * (acos(sqrt((0.5 - (0.5 * x)))) - (pi * 0.5))); end
code[x_] := N[(N[(Pi / 2.0), $MachinePrecision] + N[(2.0 * N[(N[ArcCos[N[Sqrt[N[(0.5 - N[(0.5 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{2} + 2 \cdot \left(\cos^{-1} \left(\sqrt{0.5 - 0.5 \cdot x}\right) - \pi \cdot 0.5\right)
\end{array}
(FPCore (x) :precision binary64 (+ (* PI 0.5) (* 2.0 (asin (sqrt (+ 0.5 (* x -0.5)))))))
double code(double x) {
return (((double) M_PI) * 0.5) + (2.0 * asin(sqrt((0.5 + (x * -0.5)))));
}
public static double code(double x) {
return (Math.PI * 0.5) + (2.0 * Math.asin(Math.sqrt((0.5 + (x * -0.5)))));
}
def code(x): return (math.pi * 0.5) + (2.0 * math.asin(math.sqrt((0.5 + (x * -0.5)))))
function code(x) return Float64(Float64(pi * 0.5) + Float64(2.0 * asin(sqrt(Float64(0.5 + Float64(x * -0.5)))))) end
function tmp = code(x) tmp = (pi * 0.5) + (2.0 * asin(sqrt((0.5 + (x * -0.5))))); end
code[x_] := N[(N[(Pi * 0.5), $MachinePrecision] + N[(2.0 * N[ArcSin[N[Sqrt[N[(0.5 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\pi \cdot 0.5 + 2 \cdot \sin^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)
\end{array}
(FPCore (x) :precision binary64 (- (/ PI 2.0) (* 2.0 (asin (sqrt (/ (- 1.0 x) 2.0))))))
double code(double x) {
return (((double) M_PI) / 2.0) - (2.0 * asin(sqrt(((1.0 - x) / 2.0))));
}
public static double code(double x) {
return (Math.PI / 2.0) - (2.0 * Math.asin(Math.sqrt(((1.0 - x) / 2.0))));
}
def code(x): return (math.pi / 2.0) - (2.0 * math.asin(math.sqrt(((1.0 - x) / 2.0))))
function code(x) return Float64(Float64(pi / 2.0) - Float64(2.0 * asin(sqrt(Float64(Float64(1.0 - x) / 2.0))))) end
function tmp = code(x) tmp = (pi / 2.0) - (2.0 * asin(sqrt(((1.0 - x) / 2.0)))); end
code[x_] := N[(N[(Pi / 2.0), $MachinePrecision] - N[(2.0 * N[ArcSin[N[Sqrt[N[(N[(1.0 - x), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\pi}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1 - x}{2}}\right)
\end{array}
(FPCore (x) :precision binary64 (asin x))
double code(double x) {
return asin(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = asin(x)
end function
public static double code(double x) {
return Math.asin(x);
}
def code(x): return math.asin(x)
function code(x) return asin(x) end
function tmp = code(x) tmp = asin(x); end
code[x_] := N[ArcSin[x], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} x
\end{array}
herbie shell --seed 2024003
(FPCore (x)
:name "Ian Simplification"
:precision binary64
:herbie-target
(asin x)
(- (/ PI 2.0) (* 2.0 (asin (sqrt (/ (- 1.0 x) 2.0))))))