\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}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{elif}\;t_1 \leq -8.395939912127468 \cdot 10^{-255} \lor \neg \left(t_1 \leq 0\right) \land t_1 \leq 1.1118112080121773 \cdot 10^{+296}:\\
\;\;\;\;\left(y + \left(x + \frac{y \cdot t}{a - t}\right)\right) - \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - a}{t}\\
\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)))))
(if (<= t_1 (- INFINITY))
(+ x (* (/ y t) (- z a)))
(if (or (<= t_1 -8.395939912127468e-255)
(and (not (<= t_1 0.0)) (<= t_1 1.1118112080121773e+296)))
(- (+ y (+ x (/ (* y t) (- a t)))) (/ (* y z) (- a t)))
(+ x (* y (/ (- z a) t)))))))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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + ((y / t) * (z - a));
} else if ((t_1 <= -8.395939912127468e-255) || (!(t_1 <= 0.0) && (t_1 <= 1.1118112080121773e+296))) {
tmp = (y + (x + ((y * t) / (a - t)))) - ((y * z) / (a - t));
} else {
tmp = x + (y * ((z - a) / t));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 17.0 |
|---|---|
| Target | 8.5 |
| Herbie | 5.0 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 64.0
Simplified26.2
Taylor expanded in t around inf 41.1
Simplified21.3
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -8.3959399121274677e-255 or 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 1.11181120801217729e296Initial program 1.6
Simplified2.9
Taylor expanded in y around 0 1.5
if -8.3959399121274677e-255 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0 or 1.11181120801217729e296 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 57.4
Simplified40.6
Taylor expanded in t around inf 21.0
Simplified13.2
Applied div-inv_binary6413.3
Applied associate-*l*_binary6411.6
Simplified11.6
Final simplification5.0
herbie shell --seed 2022081
(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))))