\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.6156012038310011 \cdot 10^{-15}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + t \cdot \frac{1}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{elif}\;z \cdot 3 \le 3.0286975700409486 \cdot 10^{-93}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + 0.333333333333333315 \cdot \frac{t}{z \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.615601203831001e-15)) {
VAR = ((x - (y / (z * 3.0))) + (t * (1.0 / ((z * 3.0) * y))));
} else {
double VAR_1;
if (((z * 3.0) <= 3.0286975700409486e-93)) {
VAR_1 = ((x - (y / (z * 3.0))) + ((1.0 / (z * 3.0)) * (t / y)));
} else {
VAR_1 = ((x - (y / (z * 3.0))) + (0.3333333333333333 * (t / (z * y))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.6 |
|---|---|
| Target | 1.8 |
| Herbie | 0.6 |
if (* z 3.0) < -1.615601203831001e-15Initial program 0.4
rmApplied div-inv0.4
if -1.615601203831001e-15 < (* z 3.0) < 3.0286975700409486e-93Initial program 13.3
rmApplied *-un-lft-identity13.3
Applied times-frac0.3
if 3.0286975700409486e-93 < (* z 3.0) Initial program 0.9
Taylor expanded around 0 0.9
Final simplification0.6
herbie shell --seed 2020103
(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))))