| Alternative 1 | |
|---|---|
| Error | 91.73% |
| Cost | 19840 |
\[\pi \cdot -0.5 + 2 \cdot \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)
\]
(FPCore (x) :precision binary64 (- (/ PI 2.0) (* 2.0 (asin (sqrt (/ (- 1.0 x) 2.0))))))
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (+ 0.5 (* x -0.5)))))
(*
(pow (cbrt (+ (* 0.5 PI) (* -2.0 (- (* 0.5 PI) (acos t_0))))) 2.0)
(cbrt (+ (* 0.5 PI) (* -2.0 (asin t_0)))))))double code(double x) {
return (((double) M_PI) / 2.0) - (2.0 * asin(sqrt(((1.0 - x) / 2.0))));
}
double code(double x) {
double t_0 = sqrt((0.5 + (x * -0.5)));
return pow(cbrt(((0.5 * ((double) M_PI)) + (-2.0 * ((0.5 * ((double) M_PI)) - acos(t_0))))), 2.0) * cbrt(((0.5 * ((double) M_PI)) + (-2.0 * asin(t_0))));
}
public static double code(double x) {
return (Math.PI / 2.0) - (2.0 * Math.asin(Math.sqrt(((1.0 - x) / 2.0))));
}
public static double code(double x) {
double t_0 = Math.sqrt((0.5 + (x * -0.5)));
return Math.pow(Math.cbrt(((0.5 * Math.PI) + (-2.0 * ((0.5 * Math.PI) - Math.acos(t_0))))), 2.0) * Math.cbrt(((0.5 * Math.PI) + (-2.0 * Math.asin(t_0))));
}
function code(x) return Float64(Float64(pi / 2.0) - Float64(2.0 * asin(sqrt(Float64(Float64(1.0 - x) / 2.0))))) end
function code(x) t_0 = sqrt(Float64(0.5 + Float64(x * -0.5))) return Float64((cbrt(Float64(Float64(0.5 * pi) + Float64(-2.0 * Float64(Float64(0.5 * pi) - acos(t_0))))) ^ 2.0) * cbrt(Float64(Float64(0.5 * pi) + Float64(-2.0 * asin(t_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]
code[x_] := Block[{t$95$0 = N[Sqrt[N[(0.5 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[Power[N[(N[(0.5 * Pi), $MachinePrecision] + N[(-2.0 * N[(N[(0.5 * Pi), $MachinePrecision] - N[ArcCos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[N[(N[(0.5 * Pi), $MachinePrecision] + N[(-2.0 * N[ArcSin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\frac{\pi}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1 - x}{2}}\right)
\begin{array}{l}
t_0 := \sqrt{0.5 + x \cdot -0.5}\\
{\left(\sqrt[3]{0.5 \cdot \pi + -2 \cdot \left(0.5 \cdot \pi - \cos^{-1} t_0\right)}\right)}^{2} \cdot \sqrt[3]{0.5 \cdot \pi + -2 \cdot \sin^{-1} t_0}
\end{array}
Results
| Original | 93.18% |
|---|---|
| Target | 0% |
| Herbie | 91.72% |
Initial program 93.18
Applied egg-rr93.18
Applied egg-rr91.72
Applied egg-rr91.72
Taylor expanded in x around inf 91.72
Final simplification91.72
| Alternative 1 | |
|---|---|
| Error | 91.73% |
| Cost | 19840 |
| Alternative 2 | |
|---|---|
| Error | 94.62% |
| Cost | 19584 |
herbie shell --seed 2023090
(FPCore (x)
:name "Ian Simplification"
:precision binary64
:herbie-target
(asin x)
(- (/ PI 2.0) (* 2.0 (asin (sqrt (/ (- 1.0 x) 2.0))))))