\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := \left(x + y\right) - \frac{y \cdot \left(z - t\right)}{a - t}\\
t_2 := x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \left(y + \left(x + \frac{y \cdot t}{a - t}\right)\right) - \frac{y \cdot z}{a - t}\\
\mathbf{if}\;t_1 \leq -8.58433215623443 \cdot 10^{-238}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t_1 \leq 3.125800751618182 \cdot 10^{-271}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{t}\right) - \frac{y \cdot a}{t}\\
\mathbf{elif}\;t_1 \leq 7.107574987379859 \cdot 10^{+305}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}\\
\end{array}
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ x y) (/ (* y (- z t)) (- a t))))
(t_2 (+ x (* (/ y t) (- z a)))))
(if (<= t_1 (- INFINITY))
t_2
(let* ((t_3 (- (+ y (+ x (/ (* y t) (- a t)))) (/ (* y z) (- a t)))))
(if (<= t_1 -8.58433215623443e-238)
t_3
(if (<= t_1 3.125800751618182e-271)
(- (+ x (/ (* y z) t)) (/ (* y a) t))
(if (<= t_1 7.107574987379859e+305) t_3 t_2)))))))double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = (x + y) - ((y * (z - t)) / (a - t));
double t_2 = x + ((y / t) * (z - a));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else {
double t_3 = (y + (x + ((y * t) / (a - t)))) - ((y * z) / (a - t));
double tmp_1;
if (t_1 <= -8.58433215623443e-238) {
tmp_1 = t_3;
} else if (t_1 <= 3.125800751618182e-271) {
tmp_1 = (x + ((y * z) / t)) - ((y * a) / t);
} else if (t_1 <= 7.107574987379859e+305) {
tmp_1 = t_3;
} else {
tmp_1 = t_2;
}
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
Results
| Original | 16.6 |
|---|---|
| Target | 8.4 |
| Herbie | 4.6 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 7.107574987379859e305 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 63.1
Simplified26.8
Taylor expanded in t around inf 39.8
Simplified20.3
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -8.5843321562344294e-238 or 3.125800752e-271 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 7.107574987379859e305Initial program 1.4
Simplified2.8
Taylor expanded in y around 0 1.3
if -8.5843321562344294e-238 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 3.125800752e-271Initial program 56.7
Simplified56.4
Taylor expanded in t around inf 3.0
Final simplification4.6
herbie shell --seed 2021275
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))