\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;y \leq -7.595539797448695 \cdot 10^{+50}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{elif}\;y \leq 1.5785981729024707 \cdot 10^{-43}:\\
\;\;\;\;x - \frac{x \cdot z}{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 (<= y -7.595539797448695e+50) (/ x (/ y (- y z))) (if (<= y 1.5785981729024707e-43) (- x (/ (* x z) 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 (y <= -7.595539797448695e+50) {
tmp = x / (y / (y - z));
} else if (y <= 1.5785981729024707e-43) {
tmp = x - ((x * z) / y);
} else {
tmp = x * ((y - z) / y);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 3.3 |
| Herbie | 1.7 |
if y < -7.59553979744869488e50Initial program 19.6
rmApplied associate-/l*_binary64_198010.1
if -7.59553979744869488e50 < y < 1.5785981729024707e-43Initial program 6.7
Taylor expanded around 0 3.7
if 1.5785981729024707e-43 < y Initial program 15.3
rmApplied *-un-lft-identity_binary64_1985615.3
Applied times-frac_binary64_198620.2
Final simplification1.7
herbie shell --seed 2021093
(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))