\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \le 9.154941957803031 \cdot 10^{-62} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \le 1.74805499515868977 \cdot 10^{289}\right):\\
\;\;\;\;x \cdot \left(1 \cdot \left(1 - \frac{z}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\end{array}double code(double x, double y, double z) {
return ((x * (y - z)) / y);
}
double code(double x, double y, double z) {
double temp;
if (((((x * (y - z)) / y) <= 9.154941957803031e-62) || !(((x * (y - z)) / y) <= 1.7480549951586898e+289))) {
temp = (x * (1.0 * (1.0 - (z / y))));
} else {
temp = ((x * (y - z)) / y);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.8 |
|---|---|
| Target | 3.0 |
| Herbie | 1.9 |
if (/ (* x (- y z)) y) < 9.154941957803031e-62 or 1.7480549951586898e+289 < (/ (* x (- y z)) y) Initial program 17.0
rmApplied *-un-lft-identity17.0
Applied times-frac2.5
Simplified2.5
rmApplied *-un-lft-identity2.5
Applied *-un-lft-identity2.5
Applied times-frac2.5
Simplified2.5
Simplified2.5
if 9.154941957803031e-62 < (/ (* x (- y z)) y) < 1.7480549951586898e+289Initial program 0.3
Final simplification1.9
herbie shell --seed 2020049 +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))