\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 := \frac{y \cdot z}{a - t}\\
t_4 := \left(y + \left(x + \frac{y \cdot t}{a - t}\right)\right) - t_3\\
\mathbf{if}\;t_1 \leq -9.834406028251618 \cdot 10^{-271}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;t_1 \leq 8.645163535653227 \cdot 10^{-224}:\\
\;\;\;\;\left(x - \frac{y \cdot a}{t}\right) - t_3\\
\mathbf{elif}\;t_1 \leq 1.3639970178885283 \cdot 10^{+305}:\\
\;\;\;\;t_4\\
\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 z) (- a t)))
(t_4 (- (+ y (+ x (/ (* y t) (- a t)))) t_3)))
(if (<= t_1 -9.834406028251618e-271)
t_4
(if (<= t_1 8.645163535653227e-224)
(- (- x (/ (* y a) t)) t_3)
(if (<= t_1 1.3639970178885283e+305) t_4 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 * z) / (a - t);
double t_4 = (y + (x + ((y * t) / (a - t)))) - t_3;
double tmp_1;
if (t_1 <= -9.834406028251618e-271) {
tmp_1 = t_4;
} else if (t_1 <= 8.645163535653227e-224) {
tmp_1 = (x - ((y * a) / t)) - t_3;
} else if (t_1 <= 1.3639970178885283e+305) {
tmp_1 = t_4;
} 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.8 |
|---|---|
| Target | 8.3 |
| Herbie | 4.5 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0 or 1.3639970178885283e305 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 62.8
Simplified28.0
Taylor expanded in t around inf 38.8
Simplified19.5
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -9.8344060282516176e-271 or 8.64516e-224 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.3639970178885283e305Initial program 1.3
Simplified2.6
Taylor expanded in y around 0 1.2
if -9.8344060282516176e-271 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 8.64516e-224Initial program 57.5
Simplified57.4
Taylor expanded in y around 0 43.6
Taylor expanded in t around inf 2.9
Simplified2.9
Final simplification4.5
herbie shell --seed 2022077
(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))))