\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;z \leq -3.0737797897570942 \cdot 10^{-40} \lor \neg \left(z \leq 2.5641904822085338 \cdot 10^{-80}\right) \land z \leq 5.35542472829832 \cdot 10^{+248}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
:precision binary64
(if (or (<= z -3.0737797897570942e-40)
(and (not (<= z 2.5641904822085338e-80))
(<= z 5.35542472829832e+248)))
(- x (* z (/ x y)))
(* x (/ (- y z) y))))double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.0737797897570942e-40) || (!(z <= 2.5641904822085338e-80) && (z <= 5.35542472829832e+248))) {
tmp = x - (z * (x / y));
} else {
tmp = x * ((y - z) / y);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.8 |
|---|---|
| Target | 3.1 |
| Herbie | 2.1 |
if z < -3.0737797897570942e-40 or 2.56419048220853379e-80 < z < 5.3554247282983202e248Initial program 11.4
rmApplied associate-/l*_binary645.0
Taylor expanded around 0 5.9
Simplified2.8
if -3.0737797897570942e-40 < z < 2.56419048220853379e-80 or 5.3554247282983202e248 < z Initial program 14.1
rmApplied *-un-lft-identity_binary6414.1
Applied times-frac_binary641.3
Simplified1.3
Final simplification2.1
herbie shell --seed 2020220
(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))