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




Bits error versus x




Bits error versus y
| Original | 22.0 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
if y < -387431.34117193345Initial program 45.3
Simplified28.7
Taylor expanded in y around inf 0.0
Simplified0.0
Applied pow2_binary640.0
Applied pow-flip_binary640.0
Simplified0.0
if -387431.34117193345 < y < 338143.070449517749Initial program 0.1
Simplified0.1
if 338143.070449517749 < y Initial program 45.6
Simplified28.7
Taylor expanded in y around inf 0.0
Simplified0.0
Applied add-cube-cbrt_binary640.3
Applied add-cube-cbrt_binary641.4
Applied prod-diff_binary641.4
Simplified0.0
Simplified0.0
Final simplification0.1
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))))