\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := x + \frac{y}{t} \cdot \left(z - a\right)\\
\mathbf{if}\;t \leq -1.9658820839659733 \cdot 10^{+171}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := x + \left(y - y \cdot \frac{z - t}{a - t}\right)\\
\mathbf{if}\;t \leq -1.1983208753291875 \cdot 10^{+129}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -1.8329458807432838 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 7.085746189680331 \cdot 10^{-107}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt[3]{a - t}\\
\left(x + y\right) - \frac{z - t}{t_3 \cdot t_3} \cdot \frac{y}{t_3}
\end{array}\\
\mathbf{elif}\;t \leq 6.631897434957769 \cdot 10^{+108}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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 t) (- z a)))))
(if (<= t -1.9658820839659733e+171)
t_1
(let* ((t_2 (+ x (- y (* y (/ (- z t) (- a t)))))))
(if (<= t -1.1983208753291875e+129)
t_2
(if (<= t -1.8329458807432838e+68)
t_1
(if (<= t 7.085746189680331e-107)
(let* ((t_3 (cbrt (- a t))))
(- (+ x y) (* (/ (- z t) (* t_3 t_3)) (/ y t_3))))
(if (<= t 6.631897434957769e+108) t_2 t_1))))))))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 / t) * (z - a));
double tmp;
if (t <= -1.9658820839659733e+171) {
tmp = t_1;
} else {
double t_2 = x + (y - (y * ((z - t) / (a - t))));
double tmp_1;
if (t <= -1.1983208753291875e+129) {
tmp_1 = t_2;
} else if (t <= -1.8329458807432838e+68) {
tmp_1 = t_1;
} else if (t <= 7.085746189680331e-107) {
double t_3 = cbrt(a - t);
tmp_1 = (x + y) - (((z - t) / (t_3 * t_3)) * (y / t_3));
} else if (t <= 6.631897434957769e+108) {
tmp_1 = t_2;
} else {
tmp_1 = t_1;
}
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 | 14.5 |
|---|---|
| Target | 7.7 |
| Herbie | 5.9 |
if t < -1.96588208396597326e171 or -1.19832087532918747e129 < t < -1.8329458807432838e68 or 6.63189743495776931e108 < t Initial program 29.0
Simplified19.6
Taylor expanded in t around inf 15.5
Simplified8.2
if -1.96588208396597326e171 < t < -1.19832087532918747e129 or 7.0857461896803313e-107 < t < 6.63189743495776931e108Initial program 13.9
Applied associate--l+_binary6412.4
Simplified6.0
if -1.8329458807432838e68 < t < 7.0857461896803313e-107Initial program 4.9
Applied add-cube-cbrt_binary645.1
Applied times-frac_binary644.3
Applied cancel-sign-sub-inv_binary644.3
Simplified4.3
Final simplification5.9
herbie shell --seed 2022067
(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))))