\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
t_1 := 0.5 \cdot \frac{y \cdot x}{a}\\
t_2 := t_1 - 4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
t_3 := 0.5 \cdot \left(y \cdot \frac{x}{a}\right) - 4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{if}\;z \cdot 9 \leq -5.431548242204504 \cdot 10^{+204}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \cdot 9 \leq -8.016112209692877 \cdot 10^{+153}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \cdot 9 \leq -2.420614830843783 \cdot 10^{-19}:\\
\;\;\;\;t_1 - \frac{4.5 \cdot t}{\frac{a}{z}}\\
\mathbf{elif}\;z \cdot 9 \leq -1.06181703990814 \cdot 10^{-229}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \cdot 9 \leq 1.0299690472364976 \cdot 10^{-170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, 0.5 \cdot x, \left(z \cdot t\right) \cdot -4.5\right)}{a}\\
\mathbf{elif}\;z \cdot 9 \leq 2.9959683726465978 \cdot 10^{+82}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 0.5 (/ (* y x) a)))
(t_2 (- t_1 (* 4.5 (* z (/ t a)))))
(t_3 (- (* 0.5 (* y (/ x a))) (* 4.5 (/ (* z t) a)))))
(if (<= (* z 9.0) -5.431548242204504e+204)
t_2
(if (<= (* z 9.0) -8.016112209692877e+153)
t_3
(if (<= (* z 9.0) -2.420614830843783e-19)
(- t_1 (/ (* 4.5 t) (/ a z)))
(if (<= (* z 9.0) -1.06181703990814e-229)
t_3
(if (<= (* z 9.0) 1.0299690472364976e-170)
(/ (fma y (* 0.5 x) (* (* z t) -4.5)) a)
(if (<= (* z 9.0) 2.9959683726465978e+82) t_3 t_2))))))))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 t_1 = 0.5 * ((y * x) / a);
double t_2 = t_1 - (4.5 * (z * (t / a)));
double t_3 = (0.5 * (y * (x / a))) - (4.5 * ((z * t) / a));
double tmp;
if ((z * 9.0) <= -5.431548242204504e+204) {
tmp = t_2;
} else if ((z * 9.0) <= -8.016112209692877e+153) {
tmp = t_3;
} else if ((z * 9.0) <= -2.420614830843783e-19) {
tmp = t_1 - ((4.5 * t) / (a / z));
} else if ((z * 9.0) <= -1.06181703990814e-229) {
tmp = t_3;
} else if ((z * 9.0) <= 1.0299690472364976e-170) {
tmp = fma(y, (0.5 * x), ((z * t) * -4.5)) / a;
} else if ((z * 9.0) <= 2.9959683726465978e+82) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 7.5 |
|---|---|
| Target | 5.7 |
| Herbie | 6.6 |
if (*.f64 z 9) < -5.4315482422045038e204 or 2.9959683726465978e82 < (*.f64 z 9) Initial program 19.2
Simplified18.9
Taylor expanded in z around 0 18.8
Applied egg-rr11.2
if -5.4315482422045038e204 < (*.f64 z 9) < -8.0161122096928771e153 or -2.42061483084378297e-19 < (*.f64 z 9) < -1.06181703990814e-229 or 1.02996904723649759e-170 < (*.f64 z 9) < 2.9959683726465978e82Initial program 5.9
Simplified6.0
Taylor expanded in z around 0 5.9
Applied egg-rr6.3
if -8.0161122096928771e153 < (*.f64 z 9) < -2.42061483084378297e-19Initial program 5.6
Simplified5.6
Taylor expanded in z around 0 5.5
Applied egg-rr5.8
if -1.06181703990814e-229 < (*.f64 z 9) < 1.02996904723649759e-170Initial program 4.7
Simplified4.7
Taylor expanded in z around 0 4.7
Applied egg-rr4.7
Applied egg-rr4.7
Final simplification6.6
herbie shell --seed 2022130
(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.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))