\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \le -9.8715650386691714 \cdot 10^{295} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \le -2.40955937979382073 \cdot 10^{116}\right):\\
\;\;\;\;x - x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\end{array}double code(double x, double y, double z) {
return (((double) (x * ((double) (y - z)))) / y);
}
double code(double x, double y, double z) {
double VAR;
if ((((((double) (x * ((double) (y - z)))) / y) <= -9.871565038669171e+295) || !((((double) (x * ((double) (y - z)))) / y) <= -2.4095593797938207e+116))) {
VAR = ((double) (x - ((double) (x * (z / y)))));
} else {
VAR = (((double) (x * ((double) (y - z)))) / y);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.8 |
|---|---|
| Target | 3.1 |
| Herbie | 2.2 |
if (/ (* x (- y z)) y) < -9.8715650386691714e295 or -2.40955937979382073e116 < (/ (* x (- y z)) y) Initial program 14.4
Simplified2.5
if -9.8715650386691714e295 < (/ (* x (- y z)) y) < -2.40955937979382073e116Initial program 0.2
Final simplification2.2
herbie shell --seed 2020182
(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))