\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\begin{array}{l}
\mathbf{if}\;x \leq -2.9658671955432057 \cdot 10^{+23}:\\
\;\;\;\;\left|\left(\frac{x}{y} + \frac{4}{y}\right) - \frac{x}{y} \cdot z\right|\\
\mathbf{elif}\;x \leq 1.0539544521138283 \cdot 10^{-166}:\\
\;\;\;\;\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 -2.9658671955432057e+23)
(fabs (- (+ (/ x y) (/ 4.0 y)) (* (/ x y) z)))
(if (<= x 1.0539544521138283e-166)
(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 <= -2.9658671955432057e+23) {
tmp = fabs(((x / y) + (4.0 / y)) - ((x / y) * z));
} else if (x <= 1.0539544521138283e-166) {
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 < -2.96586719554320569e23Initial program 0.1
Taylor expanded around 0 0.1
Simplified0.1
if -2.96586719554320569e23 < x < 1.0539544521138283e-166Initial program 2.4
Simplified0.1
if 1.0539544521138283e-166 < x Initial program 1.4
rmApplied div-inv_binary64_751.5
Applied associate-*l*_binary64_191.9
Simplified1.9
Final simplification0.7
herbie shell --seed 2020344
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))