| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 6848 |
\[\frac{x}{1 + \sqrt{x + 1}}
\]
(FPCore (x) :precision binary64 (/ x (+ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (let* ((t_0 (+ 1.0 (sqrt (+ 1.0 x))))) (/ x (/ (* t_0 t_0) t_0))))
double code(double x) {
return x / (1.0 + sqrt((x + 1.0)));
}
double code(double x) {
double t_0 = 1.0 + sqrt((1.0 + x));
return x / ((t_0 * t_0) / t_0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x / (1.0d0 + sqrt((x + 1.0d0)))
end function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = 1.0d0 + sqrt((1.0d0 + x))
code = x / ((t_0 * t_0) / t_0)
end function
public static double code(double x) {
return x / (1.0 + Math.sqrt((x + 1.0)));
}
public static double code(double x) {
double t_0 = 1.0 + Math.sqrt((1.0 + x));
return x / ((t_0 * t_0) / t_0);
}
def code(x): return x / (1.0 + math.sqrt((x + 1.0)))
def code(x): t_0 = 1.0 + math.sqrt((1.0 + x)) return x / ((t_0 * t_0) / t_0)
function code(x) return Float64(x / Float64(1.0 + sqrt(Float64(x + 1.0)))) end
function code(x) t_0 = Float64(1.0 + sqrt(Float64(1.0 + x))) return Float64(x / Float64(Float64(t_0 * t_0) / t_0)) end
function tmp = code(x) tmp = x / (1.0 + sqrt((x + 1.0))); end
function tmp = code(x) t_0 = 1.0 + sqrt((1.0 + x)); tmp = x / ((t_0 * t_0) / t_0); end
code[x_] := N[(x / N[(1.0 + N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[(1.0 + N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(x / N[(N[(t$95$0 * t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\frac{x}{1 + \sqrt{x + 1}}
\begin{array}{l}
t_0 := 1 + \sqrt{1 + x}\\
\frac{x}{\frac{t_0 \cdot t_0}{t_0}}
\end{array}
Results
Initial program 0.2
Applied egg-rr0.2
Applied egg-rr0.2
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 6848 |
| Alternative 2 | |
|---|---|
| Error | 20.9 |
| Cost | 448 |
| Alternative 3 | |
|---|---|
| Error | 20.8 |
| Cost | 448 |
| Alternative 4 | |
|---|---|
| Error | 21.3 |
| Cost | 192 |
| Alternative 5 | |
|---|---|
| Error | 60.9 |
| Cost | 64 |
herbie shell --seed 2023075
(FPCore (x)
:name "Numeric.Log:$clog1p from log-domain-0.10.2.1, B"
:precision binary64
(/ x (+ 1.0 (sqrt (+ x 1.0)))))