1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \left(\mathsf{fma}\left(x, {y}^{-2}, x\right) - {y}^{-2}\right) - \frac{x + -1}{y}\\
\mathbf{if}\;y \leq -311785542274500.1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 449605.74478200584:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (- (fma x (pow y -2.0) x) (pow y -2.0)) (/ (+ x -1.0) y))))
(if (<= y -311785542274500.1)
t_0
(if (<= y 449605.74478200584)
(- 1.0 (/ (* y (- 1.0 x)) (+ y 1.0)))
t_0))))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 = (fma(x, pow(y, -2.0), x) - pow(y, -2.0)) - ((x + -1.0) / y);
double tmp;
if (y <= -311785542274500.1) {
tmp = t_0;
} else if (y <= 449605.74478200584) {
tmp = 1.0 - ((y * (1.0 - x)) / (y + 1.0));
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y
| Original | 22.8 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
if y < -311785542274500.12 or 449605.744782005844 < y Initial program 46.1
Simplified29.5
Taylor expanded in y around inf 0.0
Simplified0.0
Applied egg-rr0.0
if -311785542274500.12 < y < 449605.744782005844Initial program 0.3
Final simplification0.1
herbie shell --seed 2022125
(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))))