1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\begin{array}{l}
t_0 := \frac{1}{y \cdot y}\\
t_1 := \left(x + \frac{x}{y \cdot y}\right) + \frac{1}{{y}^{3}}\\
\mathbf{if}\;y \leq -12257.264768591502:\\
\;\;\;\;t_1 - \left(\frac{x}{{y}^{3}} + \left(t_0 + \frac{x + -1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 180128.4190764583:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x + -1}{y + 1}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 - \left(t_0 - \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 (/ 1.0 (* y y)))
(t_1 (+ (+ x (/ x (* y y))) (/ 1.0 (pow y 3.0)))))
(if (<= y -12257.264768591502)
(- t_1 (+ (/ x (pow y 3.0)) (+ t_0 (/ (+ x -1.0) y))))
(if (<= y 180128.4190764583)
(fma y (/ (+ x -1.0) (+ y 1.0)) 1.0)
(- t_1 (- t_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 = 1.0 / (y * y);
double t_1 = (x + (x / (y * y))) + (1.0 / pow(y, 3.0));
double tmp;
if (y <= -12257.264768591502) {
tmp = t_1 - ((x / pow(y, 3.0)) + (t_0 + ((x + -1.0) / y)));
} else if (y <= 180128.4190764583) {
tmp = fma(y, ((x + -1.0) / (y + 1.0)), 1.0);
} else {
tmp = t_1 - (t_0 - (1.0 / y));
}
return tmp;
}




Bits error versus x




Bits error versus y
| Original | 22.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
if y < -12257.2647685915017Initial program 44.4
Simplified28.6
Taylor expanded in y around inf 0.0
Simplified0.0
if -12257.2647685915017 < y < 180128.419076458289Initial program 0.1
Simplified0.0
if 180128.419076458289 < y Initial program 44.5
Simplified29.1
Taylor expanded in y around inf 0.0
Simplified0.0
Taylor expanded in x around 0 0.3
Simplified0.3
Final simplification0.1
herbie shell --seed 2022088
(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))))