\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 -4.491227313089305 \cdot 10^{-248}:\\
\;\;\;\;y + \left(x + \left(y \cdot \left(t - z\right)\right) \cdot \frac{1}{a - t}\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\begin{array}{l}
t_2 := 1 + \frac{a}{t}\\
\left(x + t_2 \cdot \frac{y \cdot z}{t}\right) - y \cdot \left(\frac{a}{t} \cdot t_2\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt[3]{a - t}\\
t_4 := \sqrt[3]{t - z}\\
y + \left(x + \left(y \cdot \frac{t_4 \cdot t_4}{t_3 \cdot t_3}\right) \cdot \frac{t_4}{t_3}\right)
\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)))))
(if (<= t_1 (- INFINITY))
(+ x (* (/ y t) (- z a)))
(if (<= t_1 -4.491227313089305e-248)
(+ y (+ x (* (* y (- t z)) (/ 1.0 (- a t)))))
(if (<= t_1 0.0)
(let* ((t_2 (+ 1.0 (/ a t))))
(- (+ x (* t_2 (/ (* y z) t))) (* y (* (/ a t) t_2))))
(let* ((t_3 (cbrt (- a t))) (t_4 (cbrt (- t z))))
(+ y (+ x (* (* y (/ (* t_4 t_4) (* t_3 t_3))) (/ t_4 t_3))))))))))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 <= -4.491227313089305e-248) {
tmp = y + (x + ((y * (t - z)) * (1.0 / (a - t))));
} else if (t_1 <= 0.0) {
double t_2 = 1.0 + (a / t);
tmp = (x + (t_2 * ((y * z) / t))) - (y * ((a / t) * t_2));
} else {
double t_3 = cbrt(a - t);
double t_4 = cbrt(t - z);
tmp = y + (x + ((y * ((t_4 * t_4) / (t_3 * t_3))) * (t_4 / t_3)));
}
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 | 5.5 |
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0Initial program 64.0
Simplified27.3
Taylor expanded in t around inf 41.3
Simplified20.0
if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.4912273130893047e-248Initial program 1.4
Simplified2.9
Taylor expanded in y around 0 1.2
Simplified2.9
Applied div-inv_binary642.9
Applied associate-*r*_binary641.4
if -4.4912273130893047e-248 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 58.8
Simplified58.8
Taylor expanded in t around inf 6.0
Simplified1.8
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 12.9
Simplified7.5
Taylor expanded in y around 0 12.8
Simplified7.5
Applied add-cube-cbrt_binary647.8
Applied add-cube-cbrt_binary647.8
Applied times-frac_binary647.8
Applied associate-*r*_binary646.8
Final simplification5.5
herbie shell --seed 2021313
(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))))