\frac{x}{x + 1} - \frac{x + 1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \leq -10487.592747220726:\\
\;\;\;\;\left(\frac{-3}{x} - \frac{1}{x \cdot x}\right) - \frac{3}{{x}^{3}}\\
\mathbf{elif}\;x \leq 1977.3153917547227:\\
\;\;\;\;\frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-3}{x} - \frac{1}{x \cdot x}\right) - \left(\frac{3}{{x}^{3}} + \frac{1}{{x}^{4}}\right)\\
\end{array}(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
:precision binary64
(if (<= x -10487.592747220726)
(- (- (/ -3.0 x) (/ 1.0 (* x x))) (/ 3.0 (pow x 3.0)))
(if (<= x 1977.3153917547227)
(/
(-
(* (/ x (+ x 1.0)) (/ x (+ x 1.0)))
(* (/ (+ x 1.0) (- x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(+ (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(-
(- (/ -3.0 x) (/ 1.0 (* x x)))
(+ (/ 3.0 (pow x 3.0)) (/ 1.0 (pow x 4.0)))))))double code(double x) {
return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
double tmp;
if (x <= -10487.592747220726) {
tmp = ((-3.0 / x) - (1.0 / (x * x))) - (3.0 / pow(x, 3.0));
} else if (x <= 1977.3153917547227) {
tmp = (((x / (x + 1.0)) * (x / (x + 1.0))) - (((x + 1.0) / (x - 1.0)) * ((x + 1.0) / (x - 1.0)))) / ((x / (x + 1.0)) + ((x + 1.0) / (x - 1.0)));
} else {
tmp = ((-3.0 / x) - (1.0 / (x * x))) - ((3.0 / pow(x, 3.0)) + (1.0 / pow(x, 4.0)));
}
return tmp;
}













Bits error versus x
Results
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 7624 |
| Alternative 2 | |
|---|---|
| Error | 0.1 |
| Cost | 2114 |
| Alternative 3 | |
|---|---|
| Error | 0.1 |
| Cost | 1544 |
| Alternative 4 | |
|---|---|
| Error | 0.1 |
| Cost | 1288 |
| Alternative 5 | |
|---|---|
| Error | 0.1 |
| Cost | 1160 |
| Alternative 6 | |
|---|---|
| Error | 0.6 |
| Cost | 904 |
| Alternative 7 | |
|---|---|
| Error | 0.9 |
| Cost | 776 |
| Alternative 8 | |
|---|---|
| Error | 1.0 |
| Cost | 648 |
| Alternative 9 | |
|---|---|
| Error | 1.4 |
| Cost | 520 |
| Alternative 10 | |
|---|---|
| Error | 30.9 |
| Cost | 64 |

if x < -10487.592747220726Initial program 59.2
Taylor expanded around inf 0.3
Simplified0.0
Simplified0.0
if -10487.592747220726 < x < 1977.31539175472267Initial program 0.1
rmApplied flip--_binary64_34630.1
Simplified0.1
if 1977.31539175472267 < x Initial program 59.1
Taylor expanded around inf 0.3
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2021044
(FPCore (x)
:name "Asymptote C"
:precision binary64
(- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))