\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \leq -133969169.14947066:\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x \cdot x}}{x}\right)\\
\mathbf{elif}\;x \leq 724.9671878446854:\\
\;\;\;\;\frac{\left(x - 1\right) \cdot \left(x - 2 \cdot \left(x + 1\right)\right) + x \cdot \left(x + 1\right)}{{x}^{3} - x}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x}}{x \cdot x}\right)\\
\end{array}(FPCore (x) :precision binary64 (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))
(FPCore (x)
:precision binary64
(if (<= x -133969169.14947066)
(+ (/ 2.0 (pow x 7.0)) (+ (/ 2.0 (pow x 5.0)) (/ (/ 2.0 (* x x)) x)))
(if (<= x 724.9671878446854)
(/
(+ (* (- x 1.0) (- x (* 2.0 (+ x 1.0)))) (* x (+ x 1.0)))
(- (pow x 3.0) x))
(+ (/ 2.0 (pow x 7.0)) (+ (/ 2.0 (pow x 5.0)) (/ (/ 2.0 x) (* x x)))))))double code(double x) {
return ((double) (((double) ((1.0 / ((double) (x + 1.0))) - (2.0 / x))) + (1.0 / ((double) (x - 1.0)))));
}
double code(double x) {
double tmp;
if ((x <= -133969169.14947066)) {
tmp = ((double) ((2.0 / ((double) pow(x, 7.0))) + ((double) ((2.0 / ((double) pow(x, 5.0))) + ((2.0 / ((double) (x * x))) / x)))));
} else {
double tmp_1;
if ((x <= 724.9671878446854)) {
tmp_1 = (((double) (((double) (((double) (x - 1.0)) * ((double) (x - ((double) (2.0 * ((double) (x + 1.0)))))))) + ((double) (x * ((double) (x + 1.0)))))) / ((double) (((double) pow(x, 3.0)) - x)));
} else {
tmp_1 = ((double) ((2.0 / ((double) pow(x, 7.0))) + ((double) ((2.0 / ((double) pow(x, 5.0))) + ((2.0 / x) / ((double) (x * x)))))));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x
Results
| Original | 9.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
if x < -133969169.14947066Initial program 18.1
Taylor expanded around inf 0.4
Simplified0.4
rmApplied unpow3_binary640.5
Applied associate-/r*_binary640.1
if -133969169.14947066 < x < 724.96718784468544Initial program 0.3
rmApplied frac-sub_binary640.3
Applied frac-add_binary640.0
Simplified0.0
Simplified0.0
if 724.96718784468544 < x Initial program 20.4
Taylor expanded around inf 0.4
Simplified0.4
rmApplied cube-mult_binary640.5
Applied associate-/r*_binary640.1
Final simplification0.1
herbie shell --seed 2020219
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2.0 (* x (- (* x x) 1.0)))
(+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))