1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \le -1.3585420879223014 \cdot 10^{28} \lor \neg \left(y \le 111702921412086.141\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{1}{y} - 1, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - 1\right) \cdot y}{y + 1} + 1\\
\end{array}double f(double x, double y) {
double r704272 = 1.0;
double r704273 = x;
double r704274 = r704272 - r704273;
double r704275 = y;
double r704276 = r704274 * r704275;
double r704277 = r704275 + r704272;
double r704278 = r704276 / r704277;
double r704279 = r704272 - r704278;
return r704279;
}
double f(double x, double y) {
double r704280 = y;
double r704281 = -1.3585420879223014e+28;
bool r704282 = r704280 <= r704281;
double r704283 = 111702921412086.14;
bool r704284 = r704280 <= r704283;
double r704285 = !r704284;
bool r704286 = r704282 || r704285;
double r704287 = x;
double r704288 = r704287 / r704280;
double r704289 = 1.0;
double r704290 = r704289 / r704280;
double r704291 = r704290 - r704289;
double r704292 = fma(r704288, r704291, r704287);
double r704293 = r704287 - r704289;
double r704294 = r704293 * r704280;
double r704295 = r704280 + r704289;
double r704296 = r704294 / r704295;
double r704297 = r704296 + r704289;
double r704298 = r704286 ? r704292 : r704297;
return r704298;
}




Bits error versus x




Bits error versus y
| Original | 22.5 |
|---|---|
| Target | 0.2 |
| Herbie | 7.3 |
if y < -1.3585420879223014e+28 or 111702921412086.14 < y Initial program 47.1
Simplified29.8
Taylor expanded around inf 14.6
Simplified14.6
if -1.3585420879223014e+28 < y < 111702921412086.14Initial program 1.0
Simplified0.9
rmApplied add-cube-cbrt1.0
Applied associate-/r*1.0
rmApplied fma-udef1.0
Simplified1.0
Final simplification7.3
herbie shell --seed 2020020 +o rules:numerics
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x))))
(- 1 (/ (* (- 1 x) y) (+ y 1))))