1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \leq -3.599159768620087 \cdot 10^{+23}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.8902435904584662 \cdot 10^{+30}:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y) :precision binary64 (if (<= y -3.599159768620087e+23) x (if (<= y 1.8902435904584662e+30) (- 1.0 (/ (* y (- 1.0 x)) (+ y 1.0))) x)))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
double code(double x, double y) {
double tmp;
if (y <= -3.599159768620087e+23) {
tmp = x;
} else if (y <= 1.8902435904584662e+30) {
tmp = 1.0 - ((y * (1.0 - x)) / (y + 1.0));
} else {
tmp = x;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 22.2 |
|---|---|
| Target | 0.2 |
| Herbie | 7.8 |
if y < -3.59915976862008701e23 or 1.89024359045846623e30 < y Initial program 46.7
Taylor expanded around inf 15.3
if -3.59915976862008701e23 < y < 1.89024359045846623e30Initial program 1.6
Final simplification7.8
herbie shell --seed 2020344
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))