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




Bits error versus x




Bits error versus y
| Original | 22.5 |
|---|---|
| Target | 0.2 |
| Herbie | 0.0 |
if y < -115615.379112478447Initial program 45.6
Simplified28.0
Taylor expanded in y around inf 0.0
Simplified0.0
if -115615.379112478447 < y < 11126.107645742042Initial program 0.1
Applied flip-+_binary640.1
Applied associate-/r/_binary640.1
Applied cancel-sign-sub-inv_binary640.1
Simplified0.1
if 11126.107645742042 < y Initial program 45.4
Simplified29.7
Taylor expanded in y around inf 0.0
Simplified0.0
Applied associate--l+_binary640.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2021275
(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))))