\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\begin{array}{l}
\mathbf{if}\;\frac{x + 4}{y} - \frac{x}{y} \cdot z \leq -2.593780501472562 \cdot 10^{+48}:\\
\;\;\;\;\left|\frac{4}{y} + \frac{x}{y} \cdot \left(1 - z\right)\right|\\
\mathbf{elif}\;\frac{x + 4}{y} - \frac{x}{y} \cdot z \leq 1.9132480395880643 \cdot 10^{+32}:\\
\;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(\frac{x}{y} + 4 \cdot \frac{1}{y}\right) - \frac{x}{y} \cdot z\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 4.0) y) (* (/ x y) z)) -2.593780501472562e+48)
(fabs (+ (/ 4.0 y) (* (/ x y) (- 1.0 z))))
(if (<= (- (/ (+ x 4.0) y) (* (/ x y) z)) 1.9132480395880643e+32)
(fabs (- (/ (+ x 4.0) y) (* x (/ z y))))
(fabs (- (+ (/ x y) (* 4.0 (/ 1.0 y))) (* (/ x y) z))))))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 + 4.0) / y) - ((x / y) * z)) <= -2.593780501472562e+48) {
tmp = fabs((4.0 / y) + ((x / y) * (1.0 - z)));
} else if ((((x + 4.0) / y) - ((x / y) * z)) <= 1.9132480395880643e+32) {
tmp = fabs(((x + 4.0) / y) - (x * (z / y)));
} else {
tmp = fabs(((x / y) + (4.0 * (1.0 / y))) - ((x / y) * z));
}
return tmp;
}



Bits error versus x



Bits error versus y



Bits error versus z
Results
if (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) < -2.59378050147256204e48Initial program 0.1
Taylor expanded around 0 0.1
Simplified0.1
rmApplied associate--l+_binary64_150.1
Simplified0.1
if -2.59378050147256204e48 < (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) < 1.9132480395880643e32Initial program 3.3
rmApplied div-inv_binary64_753.3
Applied associate-*l*_binary64_190.1
Simplified0.1
if 1.9132480395880643e32 < (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z)) Initial program 0.1
Taylor expanded around 0 0.1
Final simplification0.1
herbie shell --seed 2021102
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))