\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} = -\infty:\\
\;\;\;\;\frac{x}{y} \cdot \left(y - z\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -28669507326513398000:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.40912979358746977 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.08452281427565051 \cdot 10^{301}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\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 ((((x * (y - z)) / y) <= -inf.0)) {
VAR = ((x / y) * (y - z));
} else {
double VAR_1;
if ((((x * (y - z)) / y) <= -2.8669507326513398e+19)) {
VAR_1 = ((x * (y - z)) / y);
} else {
double VAR_2;
if ((((x * (y - z)) / y) <= 2.4091297935874698e-11)) {
VAR_2 = (x * (1.0 - (z / y)));
} else {
double VAR_3;
if ((((x * (y - z)) / y) <= 2.0845228142756505e+301)) {
VAR_3 = ((x * (y - z)) / y);
} else {
VAR_3 = (x * (1.0 - (z / 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.5 |
|---|---|
| Target | 3.3 |
| Herbie | 0.2 |
if (/ (* x (- y z)) y) < -inf.0Initial program 64.0
rmApplied associate-/l*0.1
rmApplied associate-/r/0.1
if -inf.0 < (/ (* x (- y z)) y) < -2.8669507326513398e+19 or 2.4091297935874698e-11 < (/ (* x (- y z)) y) < 2.0845228142756505e+301Initial program 0.2
if -2.8669507326513398e+19 < (/ (* x (- y z)) y) < 2.4091297935874698e-11 or 2.0845228142756505e+301 < (/ (* x (- y z)) y) Initial program 14.6
rmApplied *-un-lft-identity14.6
Applied times-frac0.3
Simplified0.3
rmApplied div-sub0.3
Simplified0.3
Final simplification0.2
herbie shell --seed 2020103 +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))