1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \le -1448331083874109700 \lor \neg \left(y \le 1.83328374746711847 \cdot 10^{30}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{1}{y} - 1, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\frac{1}{y \cdot y - 1 \cdot 1} \cdot \left(y - 1\right)\right), x - 1, 1\right)\\
\end{array}double code(double x, double y) {
return ((double) (1.0 - ((double) (((double) (((double) (1.0 - x)) * y)) / ((double) (y + 1.0))))));
}
double code(double x, double y) {
double VAR;
if (((y <= -1.4483310838741097e+18) || !(y <= 1.8332837474671185e+30))) {
VAR = ((double) fma(((double) (x / y)), ((double) (((double) (1.0 / y)) - 1.0)), x));
} else {
VAR = ((double) fma(((double) (y * ((double) (((double) (1.0 / ((double) (((double) (y * y)) - ((double) (1.0 * 1.0)))))) * ((double) (y - 1.0)))))), ((double) (x - 1.0)), 1.0));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 22.4 |
|---|---|
| Target | 0.2 |
| Herbie | 7.3 |
if y < -1.4483310838741097e+18 or 1.8332837474671185e+30 < y Initial program 47.2
Simplified30.0
Taylor expanded around inf 14.5
Simplified14.5
if -1.4483310838741097e+18 < y < 1.8332837474671185e+30Initial program 1.4
Simplified1.2
rmApplied div-inv1.2
rmApplied flip-+1.2
Applied associate-/r/1.3
Final simplification7.3
herbie shell --seed 2020123 +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))))