\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;y \leq 2.556206366461948 \cdot 10^{-167}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;y \leq 7.478347114349664 \cdot 10^{+247}:\\
\;\;\;\;x + y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x + x \cdot z}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(if (<= y 2.556206366461948e-167)
(/ x (/ z (+ y z)))
(if (<= y 7.478347114349664e+247)
(+ x (* y (/ x z)))
(/ (+ (* y x) (* x z)) 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 (y <= 2.556206366461948e-167) {
tmp = x / (z / (y + z));
} else if (y <= 7.478347114349664e+247) {
tmp = x + (y * (x / z));
} else {
tmp = ((y * x) + (x * z)) / z;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.7 |
|---|---|
| Target | 2.8 |
| Herbie | 2.8 |
if y < 2.55622e-167Initial program 13.2
rmApplied associate-/l*_binary64_19222.2
Simplified2.2
if 2.55622e-167 < y < 7.47842e247Initial program 11.4
rmApplied associate-/l*_binary64_19223.3
Simplified3.3
Taylor expanded around 0 4.6
Simplified3.0
if 7.47842e247 < y Initial program 14.6
rmApplied distribute-rgt-in_binary64_190114.6
Final simplification2.8
herbie shell --seed 2020231
(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))