1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \leq -21493326675.95675 \lor \neg \left(y \leq 357233.1889861889\right):\\
\;\;\;\;\left(x + \left(\frac{1}{y} + \frac{x}{y \cdot y}\right)\right) - \left(\frac{x}{y} + {y}^{-2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{y \cdot x}{y + 1}\right) - \frac{y}{y + 1}\\
\end{array}(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y) :precision binary64 (if (or (<= y -21493326675.95675) (not (<= y 357233.1889861889))) (- (+ x (+ (/ 1.0 y) (/ x (* y y)))) (+ (/ x y) (pow y -2.0))) (- (+ 1.0 (/ (* y x) (+ y 1.0))) (/ y (+ y 1.0)))))
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 <= -21493326675.95675) || !(y <= 357233.1889861889)) {
tmp = (x + ((1.0 / y) + (x / (y * y)))) - ((x / y) + pow(y, -2.0));
} else {
tmp = (1.0 + ((y * x) / (y + 1.0))) - (y / (y + 1.0));
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 22.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
if y < -21493326675.956749 or 357233.188986188907 < y Initial program 46.0
Taylor expanded around inf 0.0
Simplified0.0
rmApplied pow2_binary640.0
Applied pow-flip_binary640.0
if -21493326675.956749 < y < 357233.188986188907Initial program 0.1
Taylor expanded around 0 0.1
Final simplification0.1
herbie shell --seed 2021113
(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))))