| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13376 |
\[2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
\]
(FPCore (x) :precision binary64 (* 2.0 (atan (sqrt (/ (- 1.0 x) (+ 1.0 x))))))
(FPCore (x) :precision binary64 (let* ((t_0 (/ (- 1.0 x) (+ 1.0 x))) (t_1 (* t_0 t_0))) (* 2.0 (atan (sqrt (* (* t_1 t_1) (/ (/ 1.0 t_0) t_1)))))))
double code(double x) {
return 2.0 * atan(sqrt(((1.0 - x) / (1.0 + x))));
}
double code(double x) {
double t_0 = (1.0 - x) / (1.0 + x);
double t_1 = t_0 * t_0;
return 2.0 * atan(sqrt(((t_1 * t_1) * ((1.0 / t_0) / t_1))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.0d0 * atan(sqrt(((1.0d0 - x) / (1.0d0 + x))))
end function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = (1.0d0 - x) / (1.0d0 + x)
t_1 = t_0 * t_0
code = 2.0d0 * atan(sqrt(((t_1 * t_1) * ((1.0d0 / t_0) / t_1))))
end function
public static double code(double x) {
return 2.0 * Math.atan(Math.sqrt(((1.0 - x) / (1.0 + x))));
}
public static double code(double x) {
double t_0 = (1.0 - x) / (1.0 + x);
double t_1 = t_0 * t_0;
return 2.0 * Math.atan(Math.sqrt(((t_1 * t_1) * ((1.0 / t_0) / t_1))));
}
def code(x): return 2.0 * math.atan(math.sqrt(((1.0 - x) / (1.0 + x))))
def code(x): t_0 = (1.0 - x) / (1.0 + x) t_1 = t_0 * t_0 return 2.0 * math.atan(math.sqrt(((t_1 * t_1) * ((1.0 / t_0) / t_1))))
function code(x) return Float64(2.0 * atan(sqrt(Float64(Float64(1.0 - x) / Float64(1.0 + x))))) end
function code(x) t_0 = Float64(Float64(1.0 - x) / Float64(1.0 + x)) t_1 = Float64(t_0 * t_0) return Float64(2.0 * atan(sqrt(Float64(Float64(t_1 * t_1) * Float64(Float64(1.0 / t_0) / t_1))))) end
function tmp = code(x) tmp = 2.0 * atan(sqrt(((1.0 - x) / (1.0 + x)))); end
function tmp = code(x) t_0 = (1.0 - x) / (1.0 + x); t_1 = t_0 * t_0; tmp = 2.0 * atan(sqrt(((t_1 * t_1) * ((1.0 / t_0) / t_1)))); end
code[x_] := N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(1.0 - x), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * t$95$0), $MachinePrecision]}, N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(N[(1.0 / t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
2 \cdot \tan^{-1} \left(\sqrt{\frac{1 - x}{1 + x}}\right)
\begin{array}{l}
t_0 := \frac{1 - x}{1 + x}\\
t_1 := t_0 \cdot t_0\\
2 \cdot \tan^{-1} \left(\sqrt{\left(t_1 \cdot t_1\right) \cdot \frac{\frac{1}{t_0}}{t_1}}\right)
\end{array}
Results
Initial program 0.0
Applied egg-rr0.0
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13376 |
| Alternative 2 | |
|---|---|
| Error | 0.7 |
| Cost | 6720 |
herbie shell --seed 2023077
(FPCore (x)
:name "arccos"
:precision binary64
(* 2.0 (atan (sqrt (/ (- 1.0 x) (+ 1.0 x))))))