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




Bits error versus x




Bits error versus y
| Original | 22.5 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
if y < -115615.379112478447Initial program 45.6
Simplified28.0
Taylor expanded in y around inf 0.0
Simplified0.0
if -115615.379112478447 < y < 225276.28286184359Initial program 0.1
Applied flip-+_binary640.1
Applied associate-/r/_binary640.1
Applied add-cube-cbrt_binary640.1
Applied prod-diff_binary640.1
Simplified0.1
Simplified0.1
if 225276.28286184359 < y Initial program 45.5
Simplified29.7
Taylor expanded in y around inf 0.0
Simplified0.0
Taylor expanded in x around inf 0.1
Simplified0.1
Final simplification0.1
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))))