\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\begin{array}{l}
\mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -4.37551561696799226 \cdot 10^{226}:\\
\;\;\;\;\frac{x}{\frac{a \cdot 2}{y}} - \frac{z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{elif}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le 2.03134039541453595 \cdot 10^{72}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2} - 4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2} - \frac{z \cdot 9}{\frac{a \cdot 2}{t}}\\
\end{array}double code(double x, double y, double z, double t, double a) {
return (((x * y) - ((z * 9.0) * t)) / (a * 2.0));
}
double code(double x, double y, double z, double t, double a) {
double temp;
if ((((x * y) - ((z * 9.0) * t)) <= -4.375515616967992e+226)) {
temp = ((x / ((a * 2.0) / y)) - ((z * (9.0 * t)) / (a * 2.0)));
} else {
double temp_1;
if ((((x * y) - ((z * 9.0) * t)) <= 2.031340395414536e+72)) {
temp_1 = (((x * y) / (a * 2.0)) - (4.5 * ((t * z) / a)));
} else {
temp_1 = (((x * y) / (a * 2.0)) - ((z * 9.0) / ((a * 2.0) / t)));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 7.5 |
|---|---|
| Target | 5.8 |
| Herbie | 5.0 |
if (- (* x y) (* (* z 9.0) t)) < -4.375515616967992e+226Initial program 31.7
rmApplied associate-*l*31.6
rmApplied div-sub31.6
rmApplied associate-/l*16.7
if -4.375515616967992e+226 < (- (* x y) (* (* z 9.0) t)) < 2.031340395414536e+72Initial program 0.9
rmApplied associate-*l*1.0
rmApplied div-sub1.0
Taylor expanded around 0 0.9
if 2.031340395414536e+72 < (- (* x y) (* (* z 9.0) t)) Initial program 14.7
rmApplied associate-*l*14.8
rmApplied div-sub14.8
rmApplied associate-*r*14.7
rmApplied associate-/l*10.8
Final simplification5.0
herbie shell --seed 2020058
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:herbie-target
(if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9) t)) (* a 2)))