
(FPCore (x) :precision binary64 (- (/ PI 2) (* 2 (asin (sqrt (/ (- 1 x) 2))))))
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), $MachinePrecision] - N[(2 * N[ArcSin[N[Sqrt[N[(N[(1 - x), $MachinePrecision] / 2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\pi}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1 - x}{2}}\right)
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ PI 2) (* 2 (asin (sqrt (/ (- 1 x) 2))))))
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), $MachinePrecision] - N[(2 * N[ArcSin[N[Sqrt[N[(N[(1 - x), $MachinePrecision] / 2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\pi}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1 - x}{2}}\right)
(FPCore (x)
:precision binary64
(let* ((t_0 (* 2 (acos (sqrt (* (- x 1) -1/2)))))
(t_1 (- t_0 (* (pow PI 2/3) (* (cbrt PI) 3/2)))))
(/
(- (* (pow (- PI t_0) 2) t_1) (* t_1 (* (* 1/4 PI) PI)))
(pow t_1 2))))double code(double x) {
double t_0 = 2.0 * acos(sqrt(((x - 1.0) * -0.5)));
double t_1 = t_0 - (pow(((double) M_PI), 0.6666666666666666) * (cbrt(((double) M_PI)) * 1.5));
return ((pow((((double) M_PI) - t_0), 2.0) * t_1) - (t_1 * ((0.25 * ((double) M_PI)) * ((double) M_PI)))) / pow(t_1, 2.0);
}
public static double code(double x) {
double t_0 = 2.0 * Math.acos(Math.sqrt(((x - 1.0) * -0.5)));
double t_1 = t_0 - (Math.pow(Math.PI, 0.6666666666666666) * (Math.cbrt(Math.PI) * 1.5));
return ((Math.pow((Math.PI - t_0), 2.0) * t_1) - (t_1 * ((0.25 * Math.PI) * Math.PI))) / Math.pow(t_1, 2.0);
}
function code(x) t_0 = Float64(2.0 * acos(sqrt(Float64(Float64(x - 1.0) * -0.5)))) t_1 = Float64(t_0 - Float64((pi ^ 0.6666666666666666) * Float64(cbrt(pi) * 1.5))) return Float64(Float64(Float64((Float64(pi - t_0) ^ 2.0) * t_1) - Float64(t_1 * Float64(Float64(0.25 * pi) * pi))) / (t_1 ^ 2.0)) end
code[x_] := Block[{t$95$0 = N[(2 * N[ArcCos[N[Sqrt[N[(N[(x - 1), $MachinePrecision] * -1/2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(N[Power[Pi, 2/3], $MachinePrecision] * N[(N[Power[Pi, 1/3], $MachinePrecision] * 3/2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Power[N[(Pi - t$95$0), $MachinePrecision], 2], $MachinePrecision] * t$95$1), $MachinePrecision] - N[(t$95$1 * N[(N[(1/4 * Pi), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[t$95$1, 2], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := 2 \cdot \cos^{-1} \left(\sqrt{\left(x - 1\right) \cdot \frac{-1}{2}}\right)\\
t_1 := t\_0 - {\pi}^{\frac{2}{3}} \cdot \left(\sqrt[3]{\pi} \cdot \frac{3}{2}\right)\\
\frac{{\left(\pi - t\_0\right)}^{2} \cdot t\_1 - t\_1 \cdot \left(\left(\frac{1}{4} \cdot \pi\right) \cdot \pi\right)}{{t\_1}^{2}}
\end{array}
Initial program 6.8%
lift-*.f64N/A
lift-asin.f64N/A
asin-acosN/A
lift-PI.f64N/A
lift-/.f64N/A
sub-flip-reverseN/A
acos-asinN/A
lift-PI.f64N/A
lift-/.f64N/A
lift-asin.f64N/A
sub-negate-revN/A
distribute-rgt-inN/A
Applied rewrites8.3%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites8.3%
Applied rewrites8.3%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/A
lift-PI.f64N/A
lift-cbrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f646.6%
Applied rewrites6.6%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/A
lift-PI.f64N/A
lift-cbrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f648.3%
Applied rewrites8.3%
lift-*.f64N/A
*-commutativeN/A
lift-PI.f64N/A
add-cube-cbrtN/A
lift-PI.f64N/A
lift-cbrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
pow1/3N/A
lift-PI.f64N/A
pow1/3N/A
pow-prod-upN/A
lower-pow.f64N/A
metadata-evalN/A
lower-*.f648.3%
Applied rewrites8.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (* 2 (acos (sqrt (* (- x 1) -1/2)))))
(t_1 (- t_0 (* 3/2 PI))))
(/
(- (* (pow (- PI t_0) 2) t_1) (* t_1 (* (* 1/4 PI) PI)))
(/
1
(pow (- (* (acos (sqrt (* -1/2 (- x 1)))) 2) (* 3/2 PI)) -2)))))double code(double x) {
double t_0 = 2.0 * acos(sqrt(((x - 1.0) * -0.5)));
double t_1 = t_0 - (1.5 * ((double) M_PI));
return ((pow((((double) M_PI) - t_0), 2.0) * t_1) - (t_1 * ((0.25 * ((double) M_PI)) * ((double) M_PI)))) / (1.0 / pow(((acos(sqrt((-0.5 * (x - 1.0)))) * 2.0) - (1.5 * ((double) M_PI))), -2.0));
}
public static double code(double x) {
double t_0 = 2.0 * Math.acos(Math.sqrt(((x - 1.0) * -0.5)));
double t_1 = t_0 - (1.5 * Math.PI);
return ((Math.pow((Math.PI - t_0), 2.0) * t_1) - (t_1 * ((0.25 * Math.PI) * Math.PI))) / (1.0 / Math.pow(((Math.acos(Math.sqrt((-0.5 * (x - 1.0)))) * 2.0) - (1.5 * Math.PI)), -2.0));
}
def code(x): t_0 = 2.0 * math.acos(math.sqrt(((x - 1.0) * -0.5))) t_1 = t_0 - (1.5 * math.pi) return ((math.pow((math.pi - t_0), 2.0) * t_1) - (t_1 * ((0.25 * math.pi) * math.pi))) / (1.0 / math.pow(((math.acos(math.sqrt((-0.5 * (x - 1.0)))) * 2.0) - (1.5 * math.pi)), -2.0))
function code(x) t_0 = Float64(2.0 * acos(sqrt(Float64(Float64(x - 1.0) * -0.5)))) t_1 = Float64(t_0 - Float64(1.5 * pi)) return Float64(Float64(Float64((Float64(pi - t_0) ^ 2.0) * t_1) - Float64(t_1 * Float64(Float64(0.25 * pi) * pi))) / Float64(1.0 / (Float64(Float64(acos(sqrt(Float64(-0.5 * Float64(x - 1.0)))) * 2.0) - Float64(1.5 * pi)) ^ -2.0))) end
function tmp = code(x) t_0 = 2.0 * acos(sqrt(((x - 1.0) * -0.5))); t_1 = t_0 - (1.5 * pi); tmp = ((((pi - t_0) ^ 2.0) * t_1) - (t_1 * ((0.25 * pi) * pi))) / (1.0 / (((acos(sqrt((-0.5 * (x - 1.0)))) * 2.0) - (1.5 * pi)) ^ -2.0)); end
code[x_] := Block[{t$95$0 = N[(2 * N[ArcCos[N[Sqrt[N[(N[(x - 1), $MachinePrecision] * -1/2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(3/2 * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Power[N[(Pi - t$95$0), $MachinePrecision], 2], $MachinePrecision] * t$95$1), $MachinePrecision] - N[(t$95$1 * N[(N[(1/4 * Pi), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1 / N[Power[N[(N[(N[ArcCos[N[Sqrt[N[(-1/2 * N[(x - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * 2), $MachinePrecision] - N[(3/2 * Pi), $MachinePrecision]), $MachinePrecision], -2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := 2 \cdot \cos^{-1} \left(\sqrt{\left(x - 1\right) \cdot \frac{-1}{2}}\right)\\
t_1 := t\_0 - \frac{3}{2} \cdot \pi\\
\frac{{\left(\pi - t\_0\right)}^{2} \cdot t\_1 - t\_1 \cdot \left(\left(\frac{1}{4} \cdot \pi\right) \cdot \pi\right)}{\frac{1}{{\left(\cos^{-1} \left(\sqrt{\frac{-1}{2} \cdot \left(x - 1\right)}\right) \cdot 2 - \frac{3}{2} \cdot \pi\right)}^{-2}}}
\end{array}
Initial program 6.8%
lift-*.f64N/A
lift-asin.f64N/A
asin-acosN/A
lift-PI.f64N/A
lift-/.f64N/A
sub-flip-reverseN/A
acos-asinN/A
lift-PI.f64N/A
lift-/.f64N/A
lift-asin.f64N/A
sub-negate-revN/A
distribute-rgt-inN/A
Applied rewrites8.3%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites8.3%
Applied rewrites8.3%
lift-pow.f64N/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
metadata-evalN/A
pow-flipN/A
lift-pow.f64N/A
lower-unsound-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
metadata-evalN/A
Applied rewrites8.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (* 2 (acos (sqrt (* (- x 1) -1/2)))))
(t_1 (- t_0 (* 3/2 PI))))
(/
(- (* (pow (- PI t_0) 2) t_1) (* t_1 (* (* 1/4 PI) PI)))
(pow t_1 2))))double code(double x) {
double t_0 = 2.0 * acos(sqrt(((x - 1.0) * -0.5)));
double t_1 = t_0 - (1.5 * ((double) M_PI));
return ((pow((((double) M_PI) - t_0), 2.0) * t_1) - (t_1 * ((0.25 * ((double) M_PI)) * ((double) M_PI)))) / pow(t_1, 2.0);
}
public static double code(double x) {
double t_0 = 2.0 * Math.acos(Math.sqrt(((x - 1.0) * -0.5)));
double t_1 = t_0 - (1.5 * Math.PI);
return ((Math.pow((Math.PI - t_0), 2.0) * t_1) - (t_1 * ((0.25 * Math.PI) * Math.PI))) / Math.pow(t_1, 2.0);
}
def code(x): t_0 = 2.0 * math.acos(math.sqrt(((x - 1.0) * -0.5))) t_1 = t_0 - (1.5 * math.pi) return ((math.pow((math.pi - t_0), 2.0) * t_1) - (t_1 * ((0.25 * math.pi) * math.pi))) / math.pow(t_1, 2.0)
function code(x) t_0 = Float64(2.0 * acos(sqrt(Float64(Float64(x - 1.0) * -0.5)))) t_1 = Float64(t_0 - Float64(1.5 * pi)) return Float64(Float64(Float64((Float64(pi - t_0) ^ 2.0) * t_1) - Float64(t_1 * Float64(Float64(0.25 * pi) * pi))) / (t_1 ^ 2.0)) end
function tmp = code(x) t_0 = 2.0 * acos(sqrt(((x - 1.0) * -0.5))); t_1 = t_0 - (1.5 * pi); tmp = ((((pi - t_0) ^ 2.0) * t_1) - (t_1 * ((0.25 * pi) * pi))) / (t_1 ^ 2.0); end
code[x_] := Block[{t$95$0 = N[(2 * N[ArcCos[N[Sqrt[N[(N[(x - 1), $MachinePrecision] * -1/2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(3/2 * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Power[N[(Pi - t$95$0), $MachinePrecision], 2], $MachinePrecision] * t$95$1), $MachinePrecision] - N[(t$95$1 * N[(N[(1/4 * Pi), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[t$95$1, 2], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := 2 \cdot \cos^{-1} \left(\sqrt{\left(x - 1\right) \cdot \frac{-1}{2}}\right)\\
t_1 := t\_0 - \frac{3}{2} \cdot \pi\\
\frac{{\left(\pi - t\_0\right)}^{2} \cdot t\_1 - t\_1 \cdot \left(\left(\frac{1}{4} \cdot \pi\right) \cdot \pi\right)}{{t\_1}^{2}}
\end{array}
Initial program 6.8%
lift-*.f64N/A
lift-asin.f64N/A
asin-acosN/A
lift-PI.f64N/A
lift-/.f64N/A
sub-flip-reverseN/A
acos-asinN/A
lift-PI.f64N/A
lift-/.f64N/A
lift-asin.f64N/A
sub-negate-revN/A
distribute-rgt-inN/A
Applied rewrites8.3%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites8.3%
Applied rewrites8.3%
(FPCore (x) :precision binary64 (let* ((t_0 (* 2 (acos (sqrt (* (- x 1) -1/2)))))) (/ (- (pow (- PI t_0) 2) (* (* 1/4 PI) PI)) (- t_0 (* 3/2 PI)))))
double code(double x) {
double t_0 = 2.0 * acos(sqrt(((x - 1.0) * -0.5)));
return (pow((((double) M_PI) - t_0), 2.0) - ((0.25 * ((double) M_PI)) * ((double) M_PI))) / (t_0 - (1.5 * ((double) M_PI)));
}
public static double code(double x) {
double t_0 = 2.0 * Math.acos(Math.sqrt(((x - 1.0) * -0.5)));
return (Math.pow((Math.PI - t_0), 2.0) - ((0.25 * Math.PI) * Math.PI)) / (t_0 - (1.5 * Math.PI));
}
def code(x): t_0 = 2.0 * math.acos(math.sqrt(((x - 1.0) * -0.5))) return (math.pow((math.pi - t_0), 2.0) - ((0.25 * math.pi) * math.pi)) / (t_0 - (1.5 * math.pi))
function code(x) t_0 = Float64(2.0 * acos(sqrt(Float64(Float64(x - 1.0) * -0.5)))) return Float64(Float64((Float64(pi - t_0) ^ 2.0) - Float64(Float64(0.25 * pi) * pi)) / Float64(t_0 - Float64(1.5 * pi))) end
function tmp = code(x) t_0 = 2.0 * acos(sqrt(((x - 1.0) * -0.5))); tmp = (((pi - t_0) ^ 2.0) - ((0.25 * pi) * pi)) / (t_0 - (1.5 * pi)); end
code[x_] := Block[{t$95$0 = N[(2 * N[ArcCos[N[Sqrt[N[(N[(x - 1), $MachinePrecision] * -1/2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[N[(Pi - t$95$0), $MachinePrecision], 2], $MachinePrecision] - N[(N[(1/4 * Pi), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(3/2 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := 2 \cdot \cos^{-1} \left(\sqrt{\left(x - 1\right) \cdot \frac{-1}{2}}\right)\\
\frac{{\left(\pi - t\_0\right)}^{2} - \left(\frac{1}{4} \cdot \pi\right) \cdot \pi}{t\_0 - \frac{3}{2} \cdot \pi}
\end{array}
Initial program 6.8%
lift-*.f64N/A
lift-asin.f64N/A
asin-acosN/A
lift-PI.f64N/A
lift-/.f64N/A
sub-flip-reverseN/A
acos-asinN/A
lift-PI.f64N/A
lift-/.f64N/A
lift-asin.f64N/A
sub-negate-revN/A
distribute-rgt-inN/A
Applied rewrites8.3%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
Applied rewrites8.3%
Applied rewrites8.3%
(FPCore (x) :precision binary64 (* (- 1 (/ (- PI (* (acos (sqrt (* (- 1 x) 1/2))) 2)) (* 1/2 PI))) (* 1/2 PI)))
double code(double x) {
return (1.0 - ((((double) M_PI) - (acos(sqrt(((1.0 - x) * 0.5))) * 2.0)) / (0.5 * ((double) M_PI)))) * (0.5 * ((double) M_PI));
}
public static double code(double x) {
return (1.0 - ((Math.PI - (Math.acos(Math.sqrt(((1.0 - x) * 0.5))) * 2.0)) / (0.5 * Math.PI))) * (0.5 * Math.PI);
}
def code(x): return (1.0 - ((math.pi - (math.acos(math.sqrt(((1.0 - x) * 0.5))) * 2.0)) / (0.5 * math.pi))) * (0.5 * math.pi)
function code(x) return Float64(Float64(1.0 - Float64(Float64(pi - Float64(acos(sqrt(Float64(Float64(1.0 - x) * 0.5))) * 2.0)) / Float64(0.5 * pi))) * Float64(0.5 * pi)) end
function tmp = code(x) tmp = (1.0 - ((pi - (acos(sqrt(((1.0 - x) * 0.5))) * 2.0)) / (0.5 * pi))) * (0.5 * pi); end
code[x_] := N[(N[(1 - N[(N[(Pi - N[(N[ArcCos[N[Sqrt[N[(N[(1 - x), $MachinePrecision] * 1/2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision] / N[(1/2 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1/2 * Pi), $MachinePrecision]), $MachinePrecision]
\left(1 - \frac{\pi - \cos^{-1} \left(\sqrt{\left(1 - x\right) \cdot \frac{1}{2}}\right) \cdot 2}{\frac{1}{2} \cdot \pi}\right) \cdot \left(\frac{1}{2} \cdot \pi\right)
Initial program 6.8%
lift-*.f64N/A
lift-asin.f64N/A
asin-acosN/A
lift-PI.f64N/A
lift-/.f64N/A
sub-flip-reverseN/A
acos-asinN/A
lift-PI.f64N/A
lift-/.f64N/A
lift-asin.f64N/A
sub-negate-revN/A
distribute-rgt-inN/A
Applied rewrites8.3%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites8.3%
(FPCore (x) :precision binary64 (- (- (* 1/2 PI) PI) (* (acos (sqrt (* (- 1 x) 1/2))) -2)))
double code(double x) {
return ((0.5 * ((double) M_PI)) - ((double) M_PI)) - (acos(sqrt(((1.0 - x) * 0.5))) * -2.0);
}
public static double code(double x) {
return ((0.5 * Math.PI) - Math.PI) - (Math.acos(Math.sqrt(((1.0 - x) * 0.5))) * -2.0);
}
def code(x): return ((0.5 * math.pi) - math.pi) - (math.acos(math.sqrt(((1.0 - x) * 0.5))) * -2.0)
function code(x) return Float64(Float64(Float64(0.5 * pi) - pi) - Float64(acos(sqrt(Float64(Float64(1.0 - x) * 0.5))) * -2.0)) end
function tmp = code(x) tmp = ((0.5 * pi) - pi) - (acos(sqrt(((1.0 - x) * 0.5))) * -2.0); end
code[x_] := N[(N[(N[(1/2 * Pi), $MachinePrecision] - Pi), $MachinePrecision] - N[(N[ArcCos[N[Sqrt[N[(N[(1 - x), $MachinePrecision] * 1/2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * -2), $MachinePrecision]), $MachinePrecision]
\left(\frac{1}{2} \cdot \pi - \pi\right) - \cos^{-1} \left(\sqrt{\left(1 - x\right) \cdot \frac{1}{2}}\right) \cdot -2
Initial program 6.8%
lift-*.f64N/A
lift-asin.f64N/A
asin-acosN/A
lift-PI.f64N/A
lift-/.f64N/A
sub-flip-reverseN/A
acos-asinN/A
lift-PI.f64N/A
lift-/.f64N/A
lift-asin.f64N/A
sub-negate-revN/A
distribute-rgt-inN/A
Applied rewrites8.3%
lift--.f64N/A
lift-+.f64N/A
associate--r+N/A
lower--.f64N/A
lower--.f648.3%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f648.3%
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied rewrites8.3%
(FPCore (x) :precision binary64 (- (* 1/2 PI) (* (asin (sqrt (* 1/2 (- 1 x)))) 2)))
double code(double x) {
return (0.5 * ((double) M_PI)) - (asin(sqrt((0.5 * (1.0 - x)))) * 2.0);
}
public static double code(double x) {
return (0.5 * Math.PI) - (Math.asin(Math.sqrt((0.5 * (1.0 - x)))) * 2.0);
}
def code(x): return (0.5 * math.pi) - (math.asin(math.sqrt((0.5 * (1.0 - x)))) * 2.0)
function code(x) return Float64(Float64(0.5 * pi) - Float64(asin(sqrt(Float64(0.5 * Float64(1.0 - x)))) * 2.0)) end
function tmp = code(x) tmp = (0.5 * pi) - (asin(sqrt((0.5 * (1.0 - x)))) * 2.0); end
code[x_] := N[(N[(1/2 * Pi), $MachinePrecision] - N[(N[ArcSin[N[Sqrt[N[(1/2 * N[(1 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision]
\frac{1}{2} \cdot \pi - \sin^{-1} \left(\sqrt{\frac{1}{2} \cdot \left(1 - x\right)}\right) \cdot 2
Initial program 6.8%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f646.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f646.8%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f646.8%
Applied rewrites6.8%
(FPCore (x) :precision binary64 (- (* PI 1/2) (* 2 (asin (sqrt 1/2)))))
double code(double x) {
return (((double) M_PI) * 0.5) - (2.0 * asin(sqrt(0.5)));
}
public static double code(double x) {
return (Math.PI * 0.5) - (2.0 * Math.asin(Math.sqrt(0.5)));
}
def code(x): return (math.pi * 0.5) - (2.0 * math.asin(math.sqrt(0.5)))
function code(x) return Float64(Float64(pi * 0.5) - Float64(2.0 * asin(sqrt(0.5)))) end
function tmp = code(x) tmp = (pi * 0.5) - (2.0 * asin(sqrt(0.5))); end
code[x_] := N[(N[(Pi * 1/2), $MachinePrecision] - N[(2 * N[ArcSin[N[Sqrt[1/2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\pi \cdot \frac{1}{2} - 2 \cdot \sin^{-1} \left(\sqrt{\frac{1}{2}}\right)
Initial program 6.8%
Taylor expanded in x around 0
Applied rewrites4.1%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f644.1%
Applied rewrites4.1%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x)
:name "Ian Simplification"
:precision binary64
(- (/ PI 2) (* 2 (asin (sqrt (/ (- 1 x) 2))))))