\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.5357642338074745 \cdot 10^{112}:\\
\;\;\;\;\left(x - \frac{1}{\frac{z \cdot 3}{y}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{elif}\;z \cdot 3 \le 3.513750229300045 \cdot 10^{89}:\\
\;\;\;\;\mathsf{fma}\left(1, x, -\frac{y}{3} \cdot \frac{1}{z}\right) + \mathsf{fma}\left(\frac{1}{z}, \left(-\frac{y}{3}\right) + \frac{y}{3}, \frac{\frac{1}{z}}{\frac{y}{\frac{t}{3}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, x, -\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \frac{\frac{y}{z}}{\sqrt[3]{3}}\right) + \mathsf{fma}\left(\frac{1}{z}, \left(-\frac{y}{3}\right) + \frac{y}{3}, \frac{\frac{t}{z \cdot 3}}{y}\right)\\
\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 temp;
if (((z * 3.0) <= -1.5357642338074745e+112)) {
temp = ((x - (1.0 / ((z * 3.0) / y))) + (t / ((z * 3.0) * y)));
} else {
double temp_1;
if (((z * 3.0) <= 3.513750229300045e+89)) {
temp_1 = (fma(1.0, x, -((y / 3.0) * (1.0 / z))) + fma((1.0 / z), (-(y / 3.0) + (y / 3.0)), ((1.0 / z) / (y / (t / 3.0)))));
} else {
temp_1 = (fma(1.0, x, -((1.0 / (cbrt(3.0) * cbrt(3.0))) * ((y / z) / cbrt(3.0)))) + fma((1.0 / z), (-(y / 3.0) + (y / 3.0)), ((t / (z * 3.0)) / y)));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 3.5 |
|---|---|
| Target | 1.6 |
| Herbie | 1.0 |
if (* z 3.0) < -1.5357642338074745e+112Initial program 0.8
rmApplied clear-num0.8
if -1.5357642338074745e+112 < (* z 3.0) < 3.513750229300045e+89Initial program 5.9
rmApplied associate-/r*1.9
rmApplied *-un-lft-identity1.9
Applied times-frac1.9
Applied *-un-lft-identity1.9
Applied prod-diff1.9
Applied associate-+l+1.9
Simplified1.9
rmApplied *-un-lft-identity1.9
Applied times-frac1.9
Applied associate-/l*1.0
if 3.513750229300045e+89 < (* z 3.0) Initial program 0.6
rmApplied associate-/r*1.1
rmApplied *-un-lft-identity1.1
Applied times-frac1.1
Applied *-un-lft-identity1.1
Applied prod-diff1.2
Applied associate-+l+1.2
Simplified1.1
rmApplied add-cube-cbrt1.1
Applied *-un-lft-identity1.1
Applied times-frac1.2
Applied associate-*l*1.2
Simplified1.2
Final simplification1.0
herbie shell --seed 2020057 +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))))