\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\begin{array}{l}
\mathbf{if}\;z \cdot 3 \le -1.19441357929082014 \cdot 10^{-136}:\\
\;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{elif}\;z \cdot 3 \le 4.1001370634933834 \cdot 10^{-235}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\
\mathbf{elif}\;z \cdot 3 \le 1.2163856744143447 \cdot 10^{-91}:\\
\;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{t}{3} \cdot \frac{\frac{1}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{3} \cdot \frac{1}{z}\right) + \frac{\frac{t}{z}}{3 \cdot y}\\
\end{array}double code(double x, double y, double z, double t) {
return ((x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((z * 3.0) <= -1.1944135792908201e-136)) {
VAR = ((x - ((y / 3.0) / z)) + (t / ((z * 3.0) * y)));
} else {
double VAR_1;
if (((z * 3.0) <= 4.1001370634933834e-235)) {
VAR_1 = ((x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y));
} else {
double VAR_2;
if (((z * 3.0) <= 1.2163856744143447e-91)) {
VAR_2 = ((x - ((y / 3.0) / z)) + ((t / 3.0) * ((1.0 / z) / y)));
} else {
VAR_2 = ((x - ((y / 3.0) * (1.0 / z))) + ((t / z) / (3.0 * y)));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.5 |
|---|---|
| Target | 1.9 |
| Herbie | 2.3 |
if (* z 3.0) < -1.1944135792908201e-136Initial program 1.1
rmApplied *-commutative1.1
Applied associate-/r*1.0
if -1.1944135792908201e-136 < (* z 3.0) < 4.1001370634933834e-235Initial program 22.0
rmApplied associate-/r*2.6
if 4.1001370634933834e-235 < (* z 3.0) < 1.2163856744143447e-91Initial program 13.1
rmApplied associate-*l*13.1
Applied associate-/r*5.0
rmApplied *-commutative5.0
Applied associate-/r*5.0
rmApplied div-inv5.0
Applied times-frac14.2
if 1.2163856744143447e-91 < (* z 3.0) Initial program 1.0
rmApplied associate-*l*0.9
Applied associate-/r*1.4
rmApplied *-commutative1.4
Applied associate-/r*1.4
rmApplied div-inv1.5
Final simplification2.3
herbie shell --seed 2020071 +o rules:numerics
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y))
(+ (- x (/ y (* z 3))) (/ t (* (* z 3) y))))