\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \leq -148.30320228357058:\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x}}{x \cdot x}\right)\\
\mathbf{elif}\;x \leq 105.62426959319559:\\
\;\;\;\;\frac{x - 2 \cdot \left(x + 1\right)}{x \cdot \left(x + 1\right)} + \frac{1}{x - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x \cdot x}}{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 -148.30320228357058)
(+ (/ 2.0 (pow x 7.0)) (+ (/ 2.0 (pow x 5.0)) (/ (/ 2.0 x) (* x x))))
(if (<= x 105.62426959319559)
(+ (/ (- x (* 2.0 (+ x 1.0))) (* x (+ x 1.0))) (/ 1.0 (- x 1.0)))
(+ (/ 2.0 (pow x 7.0)) (+ (/ 2.0 (pow x 5.0)) (/ (/ 2.0 (* x x)) x))))))double code(double x) {
return ((1.0 / (x + 1.0)) - (2.0 / x)) + (1.0 / (x - 1.0));
}
double code(double x) {
double tmp;
if (x <= -148.30320228357058) {
tmp = (2.0 / pow(x, 7.0)) + ((2.0 / pow(x, 5.0)) + ((2.0 / x) / (x * x)));
} else if (x <= 105.62426959319559) {
tmp = ((x - (2.0 * (x + 1.0))) / (x * (x + 1.0))) + (1.0 / (x - 1.0));
} else {
tmp = (2.0 / pow(x, 7.0)) + ((2.0 / pow(x, 5.0)) + ((2.0 / (x * x)) / x));
}
return tmp;
}




Bits error versus x
Results
| Original | 9.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
if x < -148.303202283570585Initial program 20.6
Taylor expanded around inf 0.5
Simplified0.5
rmApplied cube-mult_binary640.6
Applied associate-/r*_binary640.1
if -148.303202283570585 < x < 105.624269593195592Initial program 0.0
rmApplied frac-sub_binary640.0
Simplified0.0
Simplified0.0
if 105.624269593195592 < x Initial program 19.3
Taylor expanded around inf 0.5
Simplified0.5
rmApplied unpow3_binary640.5
Applied associate-/r*_binary640.1
Final simplification0.1
herbie shell --seed 2020224
(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))))