\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} = -inf.0:\\
\;\;\;\;x - \left(\sqrt[3]{x \cdot \frac{z}{y}} \cdot \sqrt[3]{x \cdot \frac{z}{y}}\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{z}{y}}\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -1.08864706213862188 \cdot 10^{-39}:\\
\;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.9376621052131412 \cdot 10^{112}:\\
\;\;\;\;x - x \cdot \frac{z}{y}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 1.5239110264834849 \cdot 10^{302}:\\
\;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x * ((double) (y - z)))) / y));
}
double code(double x, double y, double z) {
double VAR;
if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= -inf.0)) {
VAR = ((double) (x - ((double) (((double) (((double) cbrt(((double) (x * ((double) (z / y)))))) * ((double) cbrt(((double) (x * ((double) (z / y)))))))) * ((double) (((double) cbrt(x)) * ((double) cbrt(((double) (z / y))))))))));
} else {
double VAR_1;
if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= -1.0886470621386219e-39)) {
VAR_1 = ((double) (x + ((double) (((double) (x * z)) * ((double) (-1.0 / y))))));
} else {
double VAR_2;
if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= 2.937662105213141e+112)) {
VAR_2 = ((double) (x - ((double) (x * ((double) (z / y))))));
} else {
double VAR_3;
if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= 1.523911026483485e+302)) {
VAR_3 = ((double) (x + ((double) (((double) (x * z)) * ((double) (-1.0 / y))))));
} else {
VAR_3 = ((double) (x - ((double) (z * ((double) (x / y))))));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 3.0 |
| Herbie | 0.6 |
if (/ (* x (- y z)) y) < -inf.0Initial program 64.0
Simplified0.0
rmApplied add-cube-cbrt0.2
rmApplied cbrt-prod0.2
if -inf.0 < (/ (* x (- y z)) y) < -1.08864706213862188e-39 or 2.9376621052131412e112 < (/ (* x (- y z)) y) < 1.5239110264834849e302Initial program 0.2
Simplified8.3
rmApplied div-inv8.3
Applied associate-*r*0.2
if -1.08864706213862188e-39 < (/ (* x (- y z)) y) < 2.9376621052131412e112Initial program 5.5
Simplified0.9
if 1.5239110264834849e302 < (/ (* x (- y z)) y) Initial program 61.7
Simplified0.9
rmApplied add-cube-cbrt1.1
Applied *-un-lft-identity1.1
Applied times-frac1.1
Applied associate-*r*1.0
Simplified1.0
Taylor expanded around 0 21.2
Simplified1.0
Final simplification0.6
herbie shell --seed 2020185
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))