\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\begin{array}{l}
\mathbf{if}\;x \leq -5.06235049948775 \cdot 10^{+122}:\\
\;\;\;\;\left|\left(\frac{x}{y} + \frac{4}{y}\right) - \frac{x}{y} \cdot z\right|\\
\mathbf{elif}\;x \leq 3.648782790610929 \cdot 10^{-98}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\
\end{array}(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
(FPCore (x y z)
:precision binary64
(if (<= x -5.06235049948775e+122)
(fabs (- (+ (/ x y) (/ 4.0 y)) (* (/ x y) z)))
(if (<= x 3.648782790610929e-98)
(fabs (/ (- (+ x 4.0) (* x z)) y))
(fabs (- (/ (+ x 4.0) y) (* x (/ z y)))))))double code(double x, double y, double z) {
return fabs(((x + 4.0) / y) - ((x / y) * z));
}
double code(double x, double y, double z) {
double tmp;
if (x <= -5.06235049948775e+122) {
tmp = fabs(((x / y) + (4.0 / y)) - ((x / y) * z));
} else if (x <= 3.648782790610929e-98) {
tmp = fabs(((x + 4.0) - (x * z)) / y);
} else {
tmp = fabs(((x + 4.0) / y) - (x * (z / y)));
}
return tmp;
}



Bits error versus x



Bits error versus y



Bits error versus z
Results
if x < -5.06235049948774971e122Initial program 0.1
Taylor expanded around 0 0.1
Simplified0.1
if -5.06235049948774971e122 < x < 3.6487827906109293e-98Initial program 2.1
Simplified0.5
if 3.6487827906109293e-98 < x Initial program 0.6
rmApplied div-inv_binary640.7
Applied associate-*l*_binary640.9
Simplified0.9
Final simplification0.6
herbie shell --seed 2020262
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))