\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \le -1.37307015920405691 \cdot 10^{290} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \le -1.0746977451131761 \cdot 10^{-57} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \le 3.59502880248723362 \cdot 10^{-108} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \le 1.74180625989322971 \cdot 10^{238}\right)\right)\right):\\
\;\;\;\;\frac{y - z}{y} \cdot x\\
\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) <= -1.3730701592040569e+290) || !((((x * (y - z)) / y) <= -1.0746977451131761e-57) || !((((x * (y - z)) / y) <= 3.5950288024872336e-108) || !(((x * (y - z)) / y) <= 1.7418062598932297e+238))))) {
temp = (((y - z) / y) * x);
} else {
temp = ((x * (y - z)) / y);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.1 |
| Herbie | 0.9 |
if (/ (* x (- y z)) y) < -1.3730701592040569e+290 or -1.0746977451131761e-57 < (/ (* x (- y z)) y) < 3.5950288024872336e-108 or 1.7418062598932297e+238 < (/ (* x (- y z)) y) Initial program 25.1
rmApplied associate-/l*1.5
rmApplied clear-num1.6
rmApplied div-inv1.6
Applied add-sqr-sqrt1.6
Applied times-frac1.7
Simplified1.7
Simplified1.6
if -1.3730701592040569e+290 < (/ (* x (- y z)) y) < -1.0746977451131761e-57 or 3.5950288024872336e-108 < (/ (* x (- y z)) y) < 1.7418062598932297e+238Initial program 0.2
Final simplification0.9
herbie shell --seed 2020066 +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))