\frac{x \cdot \left(y - z\right)}{y}\begin{array}{l}
\mathbf{if}\;y \le -2.997145875047444652240240655689849825805 \cdot 10^{-240} \lor \neg \left(y \le 5.997849739943499755512315945487169370901 \cdot 10^{-177}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x}{y} \cdot \left(-z\right)\\
\end{array}double f(double x, double y, double z) {
double r568892 = x;
double r568893 = y;
double r568894 = z;
double r568895 = r568893 - r568894;
double r568896 = r568892 * r568895;
double r568897 = r568896 / r568893;
return r568897;
}
double f(double x, double y, double z) {
double r568898 = y;
double r568899 = -2.9971458750474447e-240;
bool r568900 = r568898 <= r568899;
double r568901 = 5.9978497399435e-177;
bool r568902 = r568898 <= r568901;
double r568903 = !r568902;
bool r568904 = r568900 || r568903;
double r568905 = x;
double r568906 = 1.0;
double r568907 = z;
double r568908 = r568907 / r568898;
double r568909 = r568906 - r568908;
double r568910 = r568905 * r568909;
double r568911 = r568905 / r568898;
double r568912 = -r568907;
double r568913 = r568911 * r568912;
double r568914 = r568905 + r568913;
double r568915 = r568904 ? r568910 : r568914;
return r568915;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 3.4 |
| Herbie | 3.3 |
if y < -2.9971458750474447e-240 or 5.9978497399435e-177 < y Initial program 12.8
rmApplied associate-/l*1.8
rmApplied div-inv2.1
Simplified2.0
if -2.9971458750474447e-240 < y < 5.9978497399435e-177Initial program 11.1
rmApplied associate-/l*13.7
rmApplied div-inv14.6
Simplified14.6
rmApplied sub-neg14.6
Applied distribute-lft-in14.6
Simplified14.6
Simplified12.8
Final simplification3.3
herbie shell --seed 2019306 +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.060202331921739e104) (- x (/ (* z x) y)) (if (< z 1.69397660138285259e213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))