\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le -118.866645563045708 \lor \neg \left(x \le 111.79023992954416\right):\\
\;\;\;\;2 \cdot \left(\left(\frac{1}{{x}^{5}} + {x}^{-3}\right) + \frac{1}{{x}^{7}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\\
\end{array}double f(double x) {
double r106200 = 1.0;
double r106201 = x;
double r106202 = r106201 + r106200;
double r106203 = r106200 / r106202;
double r106204 = 2.0;
double r106205 = r106204 / r106201;
double r106206 = r106203 - r106205;
double r106207 = r106201 - r106200;
double r106208 = r106200 / r106207;
double r106209 = r106206 + r106208;
return r106209;
}
double f(double x) {
double r106210 = x;
double r106211 = -118.86664556304571;
bool r106212 = r106210 <= r106211;
double r106213 = 111.79023992954416;
bool r106214 = r106210 <= r106213;
double r106215 = !r106214;
bool r106216 = r106212 || r106215;
double r106217 = 2.0;
double r106218 = 1.0;
double r106219 = 5.0;
double r106220 = pow(r106210, r106219);
double r106221 = r106218 / r106220;
double r106222 = -3.0;
double r106223 = pow(r106210, r106222);
double r106224 = r106221 + r106223;
double r106225 = 7.0;
double r106226 = pow(r106210, r106225);
double r106227 = r106218 / r106226;
double r106228 = r106224 + r106227;
double r106229 = r106217 * r106228;
double r106230 = 1.0;
double r106231 = r106210 + r106230;
double r106232 = r106230 / r106231;
double r106233 = r106217 / r106210;
double r106234 = r106232 - r106233;
double r106235 = r106210 * r106210;
double r106236 = r106230 * r106230;
double r106237 = r106235 - r106236;
double r106238 = r106230 / r106237;
double r106239 = r106238 * r106231;
double r106240 = r106234 + r106239;
double r106241 = r106216 ? r106229 : r106240;
return r106241;
}




Bits error versus x
Results
| Original | 9.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.0 |
if x < -118.86664556304571 or 111.79023992954416 < x Initial program 19.7
rmApplied flip--49.8
Applied associate-/r/52.8
Taylor expanded around inf 0.5
Simplified0.5
rmApplied pow-flip0.0
Simplified0.0
if -118.86664556304571 < x < 111.79023992954416Initial program 0.0
rmApplied flip--0.0
Applied associate-/r/0.0
Final simplification0.0
herbie shell --seed 2020042 +o rules:numerics
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))