1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
\mathbf{if}\;t_0 \leq 0.9849550736707858:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x + -1}{1 + y}, 1\right)\\
\mathbf{elif}\;t_0 \leq 1.0000000003700626:\\
\;\;\;\;\left(x + \frac{x}{y \cdot y}\right) - \left({y}^{-2} + \frac{x + -1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{y}{1 + y}\\
\mathsf{fma}\left(t_1, x, 1\right) - t_1
\end{array}\\
\end{array}
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (+ 1.0 y))))
(if (<= t_0 0.9849550736707858)
(fma y (/ (+ x -1.0) (+ 1.0 y)) 1.0)
(if (<= t_0 1.0000000003700626)
(- (+ x (/ x (* y y))) (+ (pow y -2.0) (/ (+ x -1.0) y)))
(let* ((t_1 (/ y (+ 1.0 y)))) (- (fma t_1 x 1.0) t_1))))))double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.9849550736707858) {
tmp = fma(y, ((x + -1.0) / (1.0 + y)), 1.0);
} else if (t_0 <= 1.0000000003700626) {
tmp = (x + (x / (y * y))) - (pow(y, -2.0) + ((x + -1.0) / y));
} else {
double t_1 = y / (1.0 + y);
tmp = fma(t_1, x, 1.0) - t_1;
}
return tmp;
}




Bits error versus x




Bits error versus y
| Original | 22.0 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 0.98495507367078583Initial program 6.6
Simplified0.0
if 0.98495507367078583 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 1.0000000003700626Initial program 59.5
Simplified59.4
Taylor expanded in y around inf 0.2
Simplified0.2
Applied pow2_binary640.2
Applied pow-flip_binary640.2
Simplified0.2
if 1.0000000003700626 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) Initial program 18.8
Simplified0.7
Taylor expanded in x around 0 18.8
Simplified0.6
Final simplification0.2
herbie shell --seed 2022068
(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))))