\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\begin{array}{l}
\mathbf{if}\;x \leq -1.9291044923307063 \cdot 10^{+73} \lor \neg \left(x \leq 3.9848049043978355 \cdot 10^{+61}\right):\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(1 - z\right)\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 -1.9291044923307063e+73) (not (<= x 3.9848049043978355e+61))) (fabs (* (/ x y) (- 1.0 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 <= -1.9291044923307063e+73) || !(x <= 3.9848049043978355e+61)) {
tmp = fabs((x / y) * (1.0 - 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 | 0.7 |
| Cost | 46016 |
| Alternative 2 | |
|---|---|
| Error | 2.7 |
| Cost | 7304 |
| Alternative 3 | |
|---|---|
| Error | 9.0 |
| Cost | 7176 |
| Alternative 4 | |
|---|---|
| Error | 12.6 |
| Cost | 7754 |
| Alternative 5 | |
|---|---|
| Error | 12.6 |
| Cost | 7754 |
| Alternative 6 | |
|---|---|
| Error | 13.4 |
| Cost | 7754 |
| Alternative 7 | |
|---|---|
| Error | 18.0 |
| Cost | 6720 |
| Alternative 8 | |
|---|---|
| Error | 18.7 |
| Cost | 6920 |
| Alternative 9 | |
|---|---|
| Error | 32.4 |
| Cost | 6592 |
| Alternative 10 | |
|---|---|
| Error | 60.5 |
| Cost | 64 |


if x < -1.9291044923307063e73 or 3.9848049043978355e61 < x Initial program 0.1
Taylor expanded around inf 0.3
Simplified0.1
Simplified0.1
if -1.9291044923307063e73 < x < 3.9848049043978355e61Initial program 2.2
Simplified0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2021040
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))