\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
t_1 := {\left(y - b\right)}^{2}\\
t_2 := \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\
t_3 := \mathsf{fma}\left(\frac{y}{z}, \frac{a}{t_1}, \frac{a}{y - b}\right) - \mathsf{fma}\left(\frac{y}{z}, \frac{x}{y - b}, \mathsf{fma}\left(\frac{y}{z}, \frac{t}{t_1}, \frac{t}{y - b}\right)\right)\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \frac{\left(x \cdot y + z \cdot t\right) - z \cdot a}{\mathsf{fma}\left(z, b - y, y\right)}\\
\mathbf{if}\;t_2 \leq -4.61931178241969 \cdot 10^{-281}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\begin{array}{l}
t_5 := {\left(b - y\right)}^{2}\\
\mathsf{fma}\left(\frac{y}{b - y}, \frac{x}{z}, \mathsf{fma}\left(\frac{a}{t_5}, \frac{y}{z}, \frac{t}{b - y}\right)\right) - \mathsf{fma}\left(\frac{y}{t_5}, \frac{t}{z}, \frac{a}{b - y}\right)
\end{array}\\
\mathbf{elif}\;t_2 \leq 1.650311778742995 \cdot 10^{+294}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}\\
\end{array}
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (pow (- y b) 2.0))
(t_2 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(t_3
(-
(fma (/ y z) (/ a t_1) (/ a (- y b)))
(fma (/ y z) (/ x (- y b)) (fma (/ y z) (/ t t_1) (/ t (- y b)))))))
(if (<= t_2 (- INFINITY))
t_3
(let* ((t_4 (/ (- (+ (* x y) (* z t)) (* z a)) (fma z (- b y) y))))
(if (<= t_2 -4.61931178241969e-281)
t_4
(if (<= t_2 0.0)
(let* ((t_5 (pow (- b y) 2.0)))
(-
(fma (/ y (- b y)) (/ x z) (fma (/ a t_5) (/ y z) (/ t (- b y))))
(fma (/ y t_5) (/ t z) (/ a (- b y)))))
(if (<= t_2 1.650311778742995e+294)
t_4
(if (<= t_2 INFINITY) (/ x (- 1.0 z)) t_3))))))))double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow((y - b), 2.0);
double t_2 = ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
double t_3 = fma((y / z), (a / t_1), (a / (y - b))) - fma((y / z), (x / (y - b)), fma((y / z), (t / t_1), (t / (y - b))));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else {
double t_4 = (((x * y) + (z * t)) - (z * a)) / fma(z, (b - y), y);
double tmp_1;
if (t_2 <= -4.61931178241969e-281) {
tmp_1 = t_4;
} else if (t_2 <= 0.0) {
double t_5 = pow((b - y), 2.0);
tmp_1 = fma((y / (b - y)), (x / z), fma((a / t_5), (y / z), (t / (b - y)))) - fma((y / t_5), (t / z), (a / (b - y)));
} else if (t_2 <= 1.650311778742995e+294) {
tmp_1 = t_4;
} else if (t_2 <= ((double) INFINITY)) {
tmp_1 = x / (1.0 - z);
} else {
tmp_1 = t_3;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
| Original | 23.5 |
|---|---|
| Target | 18.4 |
| Herbie | 5.3 |
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or +inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 64.0
Taylor expanded in z around -inf 40.3
Simplified10.8
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -4.6193117824196899e-281 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.6503117787429951e294Initial program 0.3
Taylor expanded in y around 0 0.3
Simplified0.3
Applied sub-neg_binary640.3
Applied distribute-rgt-in_binary640.3
Applied associate-+r+_binary640.3
if -4.6193117824196899e-281 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 44.2
Taylor expanded in z around inf 18.6
Simplified3.3
if 1.6503117787429951e294 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < +inf.0Initial program 61.9
Taylor expanded in y around inf 29.7
Final simplification5.3
herbie shell --seed 2022077
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
:herbie-target
(- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z))))
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))