\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le -115.81600190160799:\\
\;\;\;\;\frac{2}{{x}^{3}} + \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right)\\
\mathbf{elif}\;x \le 109.21127232659:\\
\;\;\;\;\left(\frac{1}{1 + x} - \frac{2}{x}\right) + \frac{1}{x - 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{\frac{1}{\frac{x}{\frac{2}{x}}}}{x}\\
\end{array}double f(double x) {
double r3330053 = 1.0;
double r3330054 = x;
double r3330055 = r3330054 + r3330053;
double r3330056 = r3330053 / r3330055;
double r3330057 = 2.0;
double r3330058 = r3330057 / r3330054;
double r3330059 = r3330056 - r3330058;
double r3330060 = r3330054 - r3330053;
double r3330061 = r3330053 / r3330060;
double r3330062 = r3330059 + r3330061;
return r3330062;
}
double f(double x) {
double r3330063 = x;
double r3330064 = -115.81600190160799;
bool r3330065 = r3330063 <= r3330064;
double r3330066 = 2.0;
double r3330067 = 3.0;
double r3330068 = pow(r3330063, r3330067);
double r3330069 = r3330066 / r3330068;
double r3330070 = 7.0;
double r3330071 = pow(r3330063, r3330070);
double r3330072 = r3330066 / r3330071;
double r3330073 = 5.0;
double r3330074 = pow(r3330063, r3330073);
double r3330075 = r3330066 / r3330074;
double r3330076 = r3330072 + r3330075;
double r3330077 = r3330069 + r3330076;
double r3330078 = 109.21127232659;
bool r3330079 = r3330063 <= r3330078;
double r3330080 = 1.0;
double r3330081 = r3330080 + r3330063;
double r3330082 = r3330080 / r3330081;
double r3330083 = r3330066 / r3330063;
double r3330084 = r3330082 - r3330083;
double r3330085 = r3330063 - r3330080;
double r3330086 = r3330080 / r3330085;
double r3330087 = r3330084 + r3330086;
double r3330088 = r3330063 / r3330083;
double r3330089 = r3330080 / r3330088;
double r3330090 = r3330089 / r3330063;
double r3330091 = r3330076 + r3330090;
double r3330092 = r3330079 ? r3330087 : r3330091;
double r3330093 = r3330065 ? r3330077 : r3330092;
return r3330093;
}




Bits error versus x
Results
| Original | 10.1 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if x < -115.81600190160799Initial program 20.4
Taylor expanded around -inf 0.5
Simplified0.5
rmApplied pow10.5
Applied pow10.5
Applied pow-sqr0.5
Applied pow10.5
Applied pow-prod-up0.5
Simplified0.5
if -115.81600190160799 < x < 109.21127232659Initial program 0.0
if 109.21127232659 < x Initial program 19.8
Taylor expanded around -inf 0.4
Simplified0.4
Taylor expanded around inf 0.4
Simplified0.1
rmApplied associate-/r*0.1
rmApplied clear-num0.2
Final simplification0.2
herbie shell --seed 2019133 +o rules:numerics
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))