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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.7 |
|---|---|
| Target | 3.2 |
| Herbie | 3.0 |
if x < 9.05678786355410441e-163Initial program 11.7
rmApplied associate-/l*_binary644.3
if 9.05678786355410441e-163 < x < 3.6996407791868194e-64Initial program 2.0
rmApplied div-inv_binary642.1
if 3.6996407791868194e-64 < x Initial program 18.9
rmApplied *-un-lft-identity_binary6418.9
Applied times-frac_binary640.5
Simplified0.5
Final simplification3.0
herbie shell --seed 2020232
(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))