\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \leq -106.76785359664669 \lor \neg \left(x \leq 126.59925884127742\right):\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{\frac{2}{x}}{x}}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}} \cdot \frac{1}{\sqrt[3]{x - 1}}\\
\end{array}(FPCore (x) :precision binary64 (+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))
(FPCore (x)
:precision binary64
(if (or (<= x -106.76785359664669) (not (<= x 126.59925884127742)))
(+ (/ 2.0 (pow x 7.0)) (+ (/ 2.0 (pow x 5.0)) (/ (/ (/ 2.0 x) x) x)))
(+
(- (/ 1.0 (+ x 1.0)) (/ 2.0 x))
(*
(/ 1.0 (* (cbrt (- x 1.0)) (cbrt (- x 1.0))))
(/ 1.0 (cbrt (- x 1.0)))))))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 <= -106.76785359664669) || !(x <= 126.59925884127742)) {
tmp = (2.0 / pow(x, 7.0)) + ((2.0 / pow(x, 5.0)) + (((2.0 / x) / x) / x));
} else {
tmp = ((1.0 / (x + 1.0)) - (2.0 / x)) + ((1.0 / (cbrt(x - 1.0) * cbrt(x - 1.0))) * (1.0 / cbrt(x - 1.0)));
}
return tmp;
}




Bits error versus x
Results
| Original | 10.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
if x < -106.76785359664669 or 126.59925884127742 < x Initial program 20.1
Taylor expanded around inf 0.5
Simplified0.5
rmApplied unpow3_binary640.6
Applied associate-/r*_binary640.1
rmApplied associate-/r*_binary640.1
if -106.76785359664669 < x < 126.59925884127742Initial program 0.0
rmApplied add-cube-cbrt_binary640.0
Applied add-sqr-sqrt_binary640.0
Applied times-frac_binary640.0
Simplified0.0
Simplified0.0
Final simplification0.1
herbie shell --seed 2020232
(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))))