\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
\mathbf{if}\;z \leq -2.5229890799554336 \cdot 10^{-122}:\\
\;\;\;\;\frac{x}{\frac{z}{z + y}}\\
\mathbf{elif}\;z \leq 2.0081309839325857 \cdot 10^{-208}:\\
\;\;\;\;\frac{x \cdot \left(z + y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z) :precision binary64 (if (<= z -2.5229890799554336e-122) (/ x (/ z (+ z y))) (if (<= z 2.0081309839325857e-208) (/ (* x (+ z y)) z) (fma x (/ y z) x))))
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 <= -2.5229890799554336e-122) {
tmp = x / (z / (z + y));
} else if (z <= 2.0081309839325857e-208) {
tmp = (x * (z + y)) / z;
} else {
tmp = fma(x, (y / z), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.2 |
|---|---|
| Target | 3.0 |
| Herbie | 3.1 |
if z < -2.52298907995543361e-122Initial program 13.1
Applied associate-/l*_binary640.6
if -2.52298907995543361e-122 < z < 2.00813098393258565e-208Initial program 11.2
if 2.00813098393258565e-208 < z Initial program 11.8
Simplified2.1
Final simplification3.1
herbie shell --seed 2022093
(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))