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




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.4 |
|---|---|
| Target | 2.8 |
| Herbie | 1.9 |
if x < -5649729669.8021564Initial program 22.3
Simplified0.1
if -5649729669.8021564 < x < 2.07416632814320603e-140Initial program 6.1
Taylor expanded in y around 0 3.2
Simplified3.7
Taylor expanded in z around 0 3.2
if 2.07416632814320603e-140 < x Initial program 15.1
Taylor expanded in y around 0 5.1
Simplified5.2
Applied fma-udef_binary645.2
Simplified1.2
Final simplification1.9
herbie shell --seed 2022125
(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))