\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{y}{b - y}\\
t_3 := \frac{t}{b - y}\\
t_4 := {\left(b - y\right)}^{2}\\
t_5 := \mathsf{fma}\left(\frac{y}{t_4}, \frac{t}{z}, \frac{a}{b - y}\right)\\
t_6 := \frac{x \cdot y + z \cdot \left(t - a\right)}{t_1}\\
t_7 := \mathsf{fma}\left(t_2, \frac{x}{z}, t_3\right) - t_5\\
\mathbf{if}\;t_6 \leq -\infty:\\
\;\;\;\;t_7\\
\mathbf{elif}\;t_6 \leq -2.5644078469744954 \cdot 10^{-215}:\\
\;\;\;\;\frac{z \cdot t}{t_1} + \frac{x \cdot y - z \cdot a}{t_1}\\
\mathbf{elif}\;t_6 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(t_2, \frac{x}{z}, \mathsf{fma}\left(\frac{a}{t_4}, \frac{y}{z}, t_3\right)\right) - t_5\\
\mathbf{elif}\;t_6 \leq 1.8400111491673562 \cdot 10^{+267}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot t - z \cdot a\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t_7\\
\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 (+ y (* z (- b y))))
(t_2 (/ y (- b y)))
(t_3 (/ t (- b y)))
(t_4 (pow (- b y) 2.0))
(t_5 (fma (/ y t_4) (/ t z) (/ a (- b y))))
(t_6 (/ (+ (* x y) (* z (- t a))) t_1))
(t_7 (- (fma t_2 (/ x z) t_3) t_5)))
(if (<= t_6 (- INFINITY))
t_7
(if (<= t_6 -2.5644078469744954e-215)
(+ (/ (* z t) t_1) (/ (- (* x y) (* z a)) t_1))
(if (<= t_6 0.0)
(- (fma t_2 (/ x z) (fma (/ a t_4) (/ y z) t_3)) t_5)
(if (<= t_6 1.8400111491673562e+267)
(/ (fma x y (- (* z t) (* z a))) (fma z (- b y) y))
t_7))))))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 = y + (z * (b - y));
double t_2 = y / (b - y);
double t_3 = t / (b - y);
double t_4 = pow((b - y), 2.0);
double t_5 = fma((y / t_4), (t / z), (a / (b - y)));
double t_6 = ((x * y) + (z * (t - a))) / t_1;
double t_7 = fma(t_2, (x / z), t_3) - t_5;
double tmp;
if (t_6 <= -((double) INFINITY)) {
tmp = t_7;
} else if (t_6 <= -2.5644078469744954e-215) {
tmp = ((z * t) / t_1) + (((x * y) - (z * a)) / t_1);
} else if (t_6 <= 0.0) {
tmp = fma(t_2, (x / z), fma((a / t_4), (y / z), t_3)) - t_5;
} else if (t_6 <= 1.8400111491673562e+267) {
tmp = fma(x, y, ((z * t) - (z * a))) / fma(z, (b - y), y);
} else {
tmp = t_7;
}
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.7 |
|---|---|
| Target | 18.5 |
| Herbie | 5.9 |
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 1.8400111491673562e267 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 62.0
Simplified62.0
Taylor expanded in z around inf 41.8
Simplified16.8
Taylor expanded in a around 0 15.6
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -2.56440784697449545e-215Initial program 0.3
Simplified0.3
Taylor expanded in x around 0 0.3
Simplified0.3
if -2.56440784697449545e-215 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0Initial program 38.4
Simplified38.4
Taylor expanded in z around inf 20.7
Simplified8.4
if 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.8400111491673562e267Initial program 0.3
Simplified0.3
Applied sub-neg_binary640.3
Applied distribute-rgt-in_binary640.3
Final simplification5.9
herbie shell --seed 2022125
(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)))))