\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\begin{array}{l}
\mathbf{if}\;x \leq -548550455324647.94 \lor \neg \left(x \leq 1.6983471831252163 \cdot 10^{+25}\right):\\
\;\;\;\;\left|\frac{x}{y} - \frac{x}{y} \cdot z\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot 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 (or (<= x -548550455324647.94) (not (<= x 1.6983471831252163e+25))) (fabs (- (/ x y) (* (/ x y) z))) (fabs (/ (- (+ x 4.0) (* 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 <= -548550455324647.94) || !(x <= 1.6983471831252163e+25)) {
tmp = fabs((x / y) - ((x / y) * z));
} else {
tmp = fabs(((x + 4.0) - (x * z)) / y);
}
return tmp;
}










Bits error versus x










Bits error versus y










Bits error versus z
Results
| Alternative 1 | |
|---|---|
| Error | 2.3 |
| Cost | 7304 |
| Alternative 2 | |
|---|---|
| Error | 9.2 |
| Cost | 7304 |
| Alternative 3 | |
|---|---|
| Error | 9.2 |
| Cost | 7176 |
| Alternative 4 | |
|---|---|
| Error | 11.4 |
| Cost | 7818 |
| Alternative 5 | |
|---|---|
| Error | 23.4 |
| Cost | 7112 |
| Alternative 6 | |
|---|---|
| Error | 33.0 |
| Cost | 6592 |
| Alternative 7 | |
|---|---|
| Error | 60.5 |
| Cost | 64 |

if x < -548550455324647.938 or 1.6983471831252163e25 < x Initial program 0.1
Taylor expanded around inf 0.1
Simplified0.1
if -548550455324647.938 < x < 1.6983471831252163e25Initial program 2.5
Simplified0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2021044
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))