\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;z \le -7.00973560583033179 \cdot 10^{117}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{1}{y - z}}\\
\mathbf{elif}\;z \le 3.9649337337447664 \cdot 10^{110}:\\
\;\;\;\;x - x \cdot \frac{z}{y}\\
\mathbf{elif}\;z \le 7.32628982310973931 \cdot 10^{217}:\\
\;\;\;\;x - \frac{1}{\frac{y}{x \cdot z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{1}{y - z}}\\
\end{array}double code(double x, double y, double z) {
return ((x * (y - z)) / y);
}
double code(double x, double y, double z) {
double VAR;
if ((z <= -7.009735605830332e+117)) {
VAR = ((x / y) / (1.0 / (y - z)));
} else {
double VAR_1;
if ((z <= 3.9649337337447664e+110)) {
VAR_1 = (x - (x * (z / y)));
} else {
double VAR_2;
if ((z <= 7.326289823109739e+217)) {
VAR_2 = (x - (1.0 / (y / (x * z))));
} else {
VAR_2 = ((x / y) / (1.0 / (y - z)));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 2.8 |
| Herbie | 3.1 |
if z < -7.009735605830332e+117 or 7.326289823109739e+217 < z Initial program 12.6
rmApplied associate-/l*11.2
rmApplied div-inv11.2
Applied associate-/r*11.9
if -7.009735605830332e+117 < z < 3.9649337337447664e+110Initial program 12.7
rmApplied associate-/l*0.5
Taylor expanded around 0 2.8
rmApplied *-un-lft-identity2.8
Applied times-frac0.7
Simplified0.7
if 3.9649337337447664e+110 < z < 7.326289823109739e+217Initial program 11.6
rmApplied associate-/l*7.6
Taylor expanded around 0 9.2
rmApplied clear-num9.2
Final simplification3.1
herbie shell --seed 2020078 +o rules:numerics
(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))