\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le -15233605608570183745536:\\
\;\;\;\;\frac{2}{{x}^{5}} + \left(\frac{2}{\left(x \cdot x\right) \cdot x} + \frac{2}{{x}^{7}}\right)\\
\mathbf{elif}\;x \le 2.90855978378677886742036867493164367335 \cdot 10^{61}:\\
\;\;\;\;\frac{2}{\left(\left(x + 1\right) \cdot x\right) \cdot \left({x}^{3} - \left(1 \cdot 1\right) \cdot 1\right)} \cdot \left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{{x}^{5}} + \left(\frac{2}{\left(x \cdot x\right) \cdot x} + \frac{2}{{x}^{7}}\right)\\
\end{array}double f(double x) {
double r8880704 = 1.0;
double r8880705 = x;
double r8880706 = r8880705 + r8880704;
double r8880707 = r8880704 / r8880706;
double r8880708 = 2.0;
double r8880709 = r8880708 / r8880705;
double r8880710 = r8880707 - r8880709;
double r8880711 = r8880705 - r8880704;
double r8880712 = r8880704 / r8880711;
double r8880713 = r8880710 + r8880712;
return r8880713;
}
double f(double x) {
double r8880714 = x;
double r8880715 = -1.5233605608570184e+22;
bool r8880716 = r8880714 <= r8880715;
double r8880717 = 2.0;
double r8880718 = 5.0;
double r8880719 = pow(r8880714, r8880718);
double r8880720 = r8880717 / r8880719;
double r8880721 = r8880714 * r8880714;
double r8880722 = r8880721 * r8880714;
double r8880723 = r8880717 / r8880722;
double r8880724 = 7.0;
double r8880725 = pow(r8880714, r8880724);
double r8880726 = r8880717 / r8880725;
double r8880727 = r8880723 + r8880726;
double r8880728 = r8880720 + r8880727;
double r8880729 = 2.908559783786779e+61;
bool r8880730 = r8880714 <= r8880729;
double r8880731 = 1.0;
double r8880732 = r8880714 + r8880731;
double r8880733 = r8880732 * r8880714;
double r8880734 = 3.0;
double r8880735 = pow(r8880714, r8880734);
double r8880736 = r8880731 * r8880731;
double r8880737 = r8880736 * r8880731;
double r8880738 = r8880735 - r8880737;
double r8880739 = r8880733 * r8880738;
double r8880740 = r8880717 / r8880739;
double r8880741 = r8880714 * r8880731;
double r8880742 = r8880736 + r8880741;
double r8880743 = r8880721 + r8880742;
double r8880744 = r8880740 * r8880743;
double r8880745 = r8880730 ? r8880744 : r8880728;
double r8880746 = r8880716 ? r8880728 : r8880745;
return r8880746;
}




Bits error versus x
Results
| Original | 9.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if x < -1.5233605608570184e+22 or 2.908559783786779e+61 < x Initial program 14.7
rmApplied frac-sub50.9
Applied frac-add50.8
Taylor expanded around inf 0.6
Simplified0.6
if -1.5233605608570184e+22 < x < 2.908559783786779e+61Initial program 6.1
rmApplied frac-sub6.1
Applied frac-add5.4
rmApplied flip3--5.4
Applied associate-*r/5.4
Applied associate-/r/5.4
Simplified5.4
Taylor expanded around 0 0.1
rmApplied pow10.1
Applied pow10.1
Applied pow10.1
Applied pow-prod-up0.1
Applied pow-prod-up0.1
Simplified0.1
Final simplification0.3
herbie shell --seed 2019174
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2.0 (* x (- (* x x) 1.0)))
(+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))