| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13440 |
\[\sqrt[3]{{\left(x + -1\right)}^{-3}} + \frac{x}{x + 1}
\]
(FPCore (x) :precision binary64 (+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))
(FPCore (x) :precision binary64 (if (<= x -3.1491243737238447e+164) 1.0 (if (<= x 217.42425346235066) (/ (- -1.0 (* x x)) (- 1.0 (* x x))) 1.0)))
double code(double x) {
return (1.0 / (x - 1.0)) + (x / (x + 1.0));
}
double code(double x) {
double tmp;
if (x <= -3.1491243737238447e+164) {
tmp = 1.0;
} else if (x <= 217.42425346235066) {
tmp = (-1.0 - (x * x)) / (1.0 - (x * x));
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (x - 1.0d0)) + (x / (x + 1.0d0))
end function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-3.1491243737238447d+164)) then
tmp = 1.0d0
else if (x <= 217.42425346235066d0) then
tmp = ((-1.0d0) - (x * x)) / (1.0d0 - (x * x))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x) {
return (1.0 / (x - 1.0)) + (x / (x + 1.0));
}
public static double code(double x) {
double tmp;
if (x <= -3.1491243737238447e+164) {
tmp = 1.0;
} else if (x <= 217.42425346235066) {
tmp = (-1.0 - (x * x)) / (1.0 - (x * x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x): return (1.0 / (x - 1.0)) + (x / (x + 1.0))
def code(x): tmp = 0 if x <= -3.1491243737238447e+164: tmp = 1.0 elif x <= 217.42425346235066: tmp = (-1.0 - (x * x)) / (1.0 - (x * x)) else: tmp = 1.0 return tmp
function code(x) return Float64(Float64(1.0 / Float64(x - 1.0)) + Float64(x / Float64(x + 1.0))) end
function code(x) tmp = 0.0 if (x <= -3.1491243737238447e+164) tmp = 1.0; elseif (x <= 217.42425346235066) tmp = Float64(Float64(-1.0 - Float64(x * x)) / Float64(1.0 - Float64(x * x))); else tmp = 1.0; end return tmp end
function tmp = code(x) tmp = (1.0 / (x - 1.0)) + (x / (x + 1.0)); end
function tmp_2 = code(x) tmp = 0.0; if (x <= -3.1491243737238447e+164) tmp = 1.0; elseif (x <= 217.42425346235066) tmp = (-1.0 - (x * x)) / (1.0 - (x * x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_] := N[(N[(1.0 / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := If[LessEqual[x, -3.1491243737238447e+164], 1.0, If[LessEqual[x, 217.42425346235066], N[(N[(-1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\frac{1}{x - 1} + \frac{x}{x + 1}
\begin{array}{l}
\mathbf{if}\;x \leq -3.1491243737238447 \cdot 10^{+164}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 217.42425346235066:\\
\;\;\;\;\frac{-1 - x \cdot x}{1 - x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
Results
if x < -3.1491243737238447e164 or 217.424253462350663 < x Initial program 0.0
Applied egg-rr42.1
Taylor expanded in x around 0 42.1
Simplified42.1
Taylor expanded in x around 0 42.1
Simplified42.1
Taylor expanded in x around inf 0.2
if -3.1491243737238447e164 < x < 217.424253462350663Initial program 0.0
Applied egg-rr0.8
Taylor expanded in x around 0 0.8
Simplified0.8
Taylor expanded in x around 0 0.8
Simplified0.8
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 13440 |
| Alternative 2 | |
|---|---|
| Error | 0.7 |
| Cost | 904 |
| Alternative 3 | |
|---|---|
| Error | 0.7 |
| Cost | 840 |
| Alternative 4 | |
|---|---|
| Error | 0.7 |
| Cost | 712 |
| Alternative 5 | |
|---|---|
| Error | 0.0 |
| Cost | 704 |
| Alternative 6 | |
|---|---|
| Error | 0.7 |
| Cost | 328 |
| Alternative 7 | |
|---|---|
| Error | 32.2 |
| Cost | 64 |

herbie shell --seed 2022320
(FPCore (x)
:name "Asymptote B"
:precision binary64
(+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))