?

Average Accuracy: 6.8% → 8.3%
Time: 21.6s
Precision: binary64
Cost: 130048

?

\[\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]{\frac{\log \left(e^{\mathsf{fma}\left(0.25, {\pi}^{2}, -4 \cdot {\sin^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)}^{2}\right)}\right)}{2 \cdot \sin^{-1} t_0 + \pi \cdot 0.5}}\right)}^{2} \cdot \sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \left(\pi \cdot 0.5 - \cos^{-1} t_0\right) \cdot -2\right)} \end{array} \]
(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
      (/
       (log
        (exp
         (fma
          0.25
          (pow PI 2.0)
          (* -4.0 (pow (asin (sqrt (fma x -0.5 0.5))) 2.0)))))
       (+ (* 2.0 (asin t_0)) (* PI 0.5))))
     2.0)
    (cbrt (fma PI 0.5 (* (- (* PI 0.5) (acos t_0)) -2.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((log(exp(fma(0.25, pow(((double) M_PI), 2.0), (-4.0 * pow(asin(sqrt(fma(x, -0.5, 0.5))), 2.0))))) / ((2.0 * asin(t_0)) + (((double) M_PI) * 0.5)))), 2.0) * cbrt(fma(((double) M_PI), 0.5, (((((double) M_PI) * 0.5) - acos(t_0)) * -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 code(x)
	t_0 = sqrt(Float64(0.5 + Float64(x * -0.5)))
	return Float64((cbrt(Float64(log(exp(fma(0.25, (pi ^ 2.0), Float64(-4.0 * (asin(sqrt(fma(x, -0.5, 0.5))) ^ 2.0))))) / Float64(Float64(2.0 * asin(t_0)) + Float64(pi * 0.5)))) ^ 2.0) * cbrt(fma(pi, 0.5, Float64(Float64(Float64(pi * 0.5) - acos(t_0)) * -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]
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[Log[N[Exp[N[(0.25 * N[Power[Pi, 2.0], $MachinePrecision] + N[(-4.0 * N[Power[N[ArcSin[N[Sqrt[N[(x * -0.5 + 0.5), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(N[(2.0 * N[ArcSin[t$95$0], $MachinePrecision]), $MachinePrecision] + N[(Pi * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[N[(Pi * 0.5 + N[(N[(N[(Pi * 0.5), $MachinePrecision] - N[ArcCos[t$95$0], $MachinePrecision]), $MachinePrecision] * -2.0), $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]{\frac{\log \left(e^{\mathsf{fma}\left(0.25, {\pi}^{2}, -4 \cdot {\sin^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)}^{2}\right)}\right)}{2 \cdot \sin^{-1} t_0 + \pi \cdot 0.5}}\right)}^{2} \cdot \sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \left(\pi \cdot 0.5 - \cos^{-1} t_0\right) \cdot -2\right)}
\end{array}

Error?

Target

Original6.8%
Target100.0%
Herbie8.3%
\[\sin^{-1} x \]

Derivation?

  1. Initial program 6.8%

    \[\frac{\pi}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1 - x}{2}}\right) \]
  2. Applied egg-rr6.8%

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \sin^{-1} \left(\sqrt{0.5 - x \cdot 0.5}\right) \cdot -2\right)}\right)}^{2} \cdot \sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \sin^{-1} \left(\sqrt{0.5 - x \cdot 0.5}\right) \cdot -2\right)}} \]
  3. Applied egg-rr6.8%

    \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{0.25 \cdot {\pi}^{2} + -4 \cdot {\sin^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)}^{2}}{\pi \cdot 0.5 + 2 \cdot \sin^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)}}}\right)}^{2} \cdot \sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \sin^{-1} \left(\sqrt{0.5 - x \cdot 0.5}\right) \cdot -2\right)} \]
  4. Applied egg-rr8.3%

    \[\leadsto {\left(\sqrt[3]{\frac{0.25 \cdot {\pi}^{2} + -4 \cdot {\sin^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)}^{2}}{\pi \cdot 0.5 + 2 \cdot \sin^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)}}\right)}^{2} \cdot \sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \color{blue}{\left(\pi \cdot 0.5 - \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)\right)} \cdot -2\right)} \]
  5. Applied egg-rr8.3%

    \[\leadsto {\left(\sqrt[3]{\frac{\color{blue}{\log \left(e^{\mathsf{fma}\left(0.25, {\pi}^{2}, -4 \cdot {\sin^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)}^{2}\right)}\right)}}{\pi \cdot 0.5 + 2 \cdot \sin^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)}}\right)}^{2} \cdot \sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \left(\pi \cdot 0.5 - \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)\right) \cdot -2\right)} \]
  6. Final simplification8.3%

    \[\leadsto {\left(\sqrt[3]{\frac{\log \left(e^{\mathsf{fma}\left(0.25, {\pi}^{2}, -4 \cdot {\sin^{-1} \left(\sqrt{\mathsf{fma}\left(x, -0.5, 0.5\right)}\right)}^{2}\right)}\right)}{2 \cdot \sin^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right) + \pi \cdot 0.5}}\right)}^{2} \cdot \sqrt[3]{\mathsf{fma}\left(\pi, 0.5, \left(\pi \cdot 0.5 - \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right)\right) \cdot -2\right)} \]

Alternatives

Alternative 1
Accuracy8.3%
Cost98432
\[\begin{array}{l} t_0 := \sqrt{0.5 + x \cdot -0.5}\\ t_1 := \sin^{-1} t_0\\ \sqrt[3]{\frac{0.25 \cdot {\pi}^{2} + -4 \cdot {t_1}^{2}}{2 \cdot t_1 + \pi \cdot 0.5}} \cdot {\left(\sqrt[3]{\pi \cdot 0.5 + \left(\pi \cdot 0.5 - \cos^{-1} t_0\right) \cdot -2}\right)}^{2} \end{array} \]
Alternative 2
Accuracy8.3%
Cost98432
\[\begin{array}{l} t_0 := \sqrt{0.5 + x \cdot -0.5}\\ t_1 := \sin^{-1} t_0\\ {\left(\sqrt[3]{\frac{0.25 \cdot {\pi}^{2} + -4 \cdot {t_1}^{2}}{2 \cdot t_1 + \pi \cdot 0.5}}\right)}^{2} \cdot \sqrt[3]{\pi \cdot 0.5 + \left(\pi \cdot 0.5 - \cos^{-1} t_0\right) \cdot -2} \end{array} \]
Alternative 3
Accuracy8.3%
Cost59264
\[\begin{array}{l} t_0 := \sqrt{0.5 + x \cdot -0.5}\\ \frac{0.25 \cdot {\pi}^{2} + -4 \cdot {\left(\pi \cdot 0.5 - \cos^{-1} t_0\right)}^{2}}{2 \cdot \sin^{-1} t_0 + \pi \cdot 0.5} \end{array} \]
Alternative 4
Accuracy8.3%
Cost32640
\[\frac{1}{\frac{1}{\mathsf{fma}\left(\pi, -0.5, 2 \cdot \cos^{-1} \left(\sqrt{\mathsf{fma}\left(-0.5, x, 0.5\right)}\right)\right)}} \]
Alternative 5
Accuracy8.3%
Cost19840
\[\pi \cdot -0.5 - \cos^{-1} \left(\sqrt{0.5 + x \cdot -0.5}\right) \cdot -2 \]
Alternative 6
Accuracy5.4%
Cost19584
\[\pi \cdot -0.5 + 2 \cdot \cos^{-1} \left(\sqrt{0.5}\right) \]

Error

Reproduce?

herbie shell --seed 2023141 
(FPCore (x)
  :name "Ian Simplification"
  :precision binary64

  :herbie-target
  (asin x)

  (- (/ PI 2.0) (* 2.0 (asin (sqrt (/ (- 1.0 x) 2.0))))))