\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\mathbf{if}\;x \leq -8.412480443797539 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.1422609114949007 \cdot 10^{-95}:\\
\;\;\;\;\mathsf{fma}\left(y, x \cdot \frac{1}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma x (/ y z) x)))
(if (<= x -8.412480443797539e-68)
t_0
(if (<= x 2.1422609114949007e-95) (fma y (* x (/ 1.0 z)) x) t_0))))double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double t_0 = fma(x, (y / z), x);
double tmp;
if (x <= -8.412480443797539e-68) {
tmp = t_0;
} else if (x <= 2.1422609114949007e-95) {
tmp = fma(y, (x * (1.0 / z)), x);
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.6 |
|---|---|
| Target | 3.0 |
| Herbie | 1.8 |
if x < -8.41248044379753882e-68 or 2.14226091149490066e-95 < x Initial program 17.1
Simplified0.5
if -8.41248044379753882e-68 < x < 2.14226091149490066e-95Initial program 6.4
Simplified7.1
Taylor expanded in y around 0 3.7
Applied egg-rr7.1
Applied egg-rr3.4
Final simplification1.8
herbie shell --seed 2022130
(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))