\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{z}, \frac{y}{b - y}, \frac{t}{b - y}\right) - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right)\\
t_2 := z \cdot \left(t - a\right)\\
t_3 := y + z \cdot \left(b - y\right)\\
t_4 := \frac{x \cdot y + t_2}{t_3}\\
\mathbf{if}\;t_4 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_4 \leq -1.9009386587944248 \cdot 10^{-274}:\\
\;\;\;\;\frac{z \cdot t}{t_3} + \frac{x \cdot y - z \cdot a}{t_3}\\
\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, \frac{a}{{\left(y - b\right)}^{2}}, \frac{a}{y - b}\right) - \mathsf{fma}\left(\frac{y}{z}, \frac{x}{y - b}, \frac{t}{y - b}\right)\\
\mathbf{elif}\;t_4 \leq 7.970143228461605 \cdot 10^{+266}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, t_2\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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
(-
(fma (/ x z) (/ y (- b y)) (/ t (- b y)))
(fma (/ y (pow (- b y) 2.0)) (/ t z) (/ a (- b y)))))
(t_2 (* z (- t a)))
(t_3 (+ y (* z (- b y))))
(t_4 (/ (+ (* x y) t_2) t_3)))
(if (<= t_4 (- INFINITY))
t_1
(if (<= t_4 -1.9009386587944248e-274)
(+ (/ (* z t) t_3) (/ (- (* x y) (* z a)) t_3))
(if (<= t_4 0.0)
(-
(fma (/ y z) (/ a (pow (- y b) 2.0)) (/ a (- y b)))
(fma (/ y z) (/ x (- y b)) (/ t (- y b))))
(if (<= t_4 7.970143228461605e+266)
(/ (fma x y t_2) (fma z (- b y) y))
t_1))))))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 = fma((x / z), (y / (b - y)), (t / (b - y))) - fma((y / pow((b - y), 2.0)), (t / z), (a / (b - y)));
double t_2 = z * (t - a);
double t_3 = y + (z * (b - y));
double t_4 = ((x * y) + t_2) / t_3;
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_4 <= -1.9009386587944248e-274) {
tmp = ((z * t) / t_3) + (((x * y) - (z * a)) / t_3);
} else if (t_4 <= 0.0) {
tmp = fma((y / z), (a / pow((y - b), 2.0)), (a / (y - b))) - fma((y / z), (x / (y - b)), (t / (y - b)));
} else if (t_4 <= 7.970143228461605e+266) {
tmp = fma(x, y, t_2) / fma(z, (b - y), y);
} else {
tmp = t_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.4 |
|---|---|
| Target | 18.1 |
| Herbie | 6.0 |
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or 7.9701432284616051e266 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 61.0
Simplified61.0
Taylor expanded in z around inf 41.8
Simplified17.6
Taylor expanded in a around 0 30.5
Simplified16.3
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -1.9009386587944248e-274Initial program 0.3
Simplified0.3
Taylor expanded in x around 0 0.3
Simplified0.3
if -1.9009386587944248e-274 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0Initial program 43.4
Simplified43.4
Taylor expanded in z around -inf 20.4
Simplified7.1
Taylor expanded in z around inf 7.1
if -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 7.9701432284616051e266Initial program 0.3
Simplified0.3
Final simplification6.0
herbie shell --seed 2022088
(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)))))