\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:\\
\;\;\;\;\mathsf{fma}\left(y, \left(t - z\right) \cdot \frac{1}{a - t}, x + y\right)\\
\mathbf{elif}\;t_1 \leq -3.105523126787935 \cdot 10^{-179}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\begin{array}{l}
t_2 := \frac{y \cdot z}{t}\\
\left(\left(x + \left(1 + \frac{a}{t}\right) \cdot t_2\right) + \left(\frac{a}{t} \cdot \frac{a}{t}\right) \cdot \left(t_2 - y\right)\right) - \frac{y \cdot a}{t}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + y \cdot \frac{t - z}{a - t}\right)\\
\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))
(fma y (* (- t z) (/ 1.0 (- a t))) (+ x y))
(if (<= t_1 -3.105523126787935e-179)
t_1
(if (<= t_1 0.0)
(let* ((t_2 (/ (* y z) t)))
(-
(+ (+ x (* (+ 1.0 (/ a t)) t_2)) (* (* (/ a t) (/ a t)) (- t_2 y)))
(/ (* y a) t)))
(+ y (+ x (* y (/ (- t 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 = fma(y, ((t - z) * (1.0 / (a - t))), (x + y));
} else if (t_1 <= -3.105523126787935e-179) {
tmp = t_1;
} else if (t_1 <= 0.0) {
double t_2 = (y * z) / t;
tmp = ((x + ((1.0 + (a / t)) * t_2)) + (((a / t) * (a / t)) * (t_2 - y))) - ((y * a) / t);
} else {
tmp = y + (x + (y * ((t - 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
| Original | 16.3 |
|---|---|
| Target | 8.7 |
| Herbie | 6.7 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 64.0
Simplified29.1
Applied div-inv_binary6429.1
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -3.1055231267879348e-179Initial program 1.3
if -3.1055231267879348e-179 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 52.8
Simplified52.4
Taylor expanded in a around 0 13.2
Simplified5.3
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 12.9
Simplified7.4
Taylor expanded in y around 0 12.8
Simplified7.5
Final simplification6.7
herbie shell --seed 2022097
(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))))