\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \leq -8.17163490039745 \cdot 10^{-193} \lor \neg \left(z \leq 7.722781478682705 \cdot 10^{-34}\right):\\
\;\;\;\;\frac{x}{\frac{z}{z + y}}\\
\mathbf{else}:\\
\;\;\;\;\left(z + y\right) \cdot \frac{x}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z) :precision binary64 (if (or (<= z -8.17163490039745e-193) (not (<= z 7.722781478682705e-34))) (/ x (/ z (+ z y))) (* (+ z y) (/ x z))))
double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.17163490039745e-193) || !(z <= 7.722781478682705e-34)) {
tmp = x / (z / (z + y));
} else {
tmp = (z + y) * (x / z);
}
return tmp;
}











Bits error versus x











Bits error versus y











Bits error versus z
Results
| Original | 11.8 |
|---|---|
| Target | 2.8 |
| Herbie | 2.8 |
| Alternative 1 | |
|---|---|
| Error | 2.9 |
| Cost | 776 |
| Alternative 2 | |
|---|---|
| Error | 7.3 |
| Cost | 1090 |
| Alternative 3 | |
|---|---|
| Error | 18.5 |
| Cost | 648 |
| Alternative 4 | |
|---|---|
| Error | 19.7 |
| Cost | 648 |
| Alternative 5 | |
|---|---|
| Error | 25.5 |
| Cost | 64 |
| Alternative 6 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |
| Alternative 7 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |

if z < -8.17163490039744971e-193 or 7.7227814786827051e-34 < z Initial program 13.1
rmApplied associate-/l*_binary64_78660.9
Simplified0.9
if -8.17163490039744971e-193 < z < 7.7227814786827051e-34Initial program 7.6
rmApplied associate-/l*_binary64_78668.9
rmApplied associate-/r/_binary64_78678.8
Simplified8.8
Final simplification2.8
herbie shell --seed 2021044
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))