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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 3.1 |
| Herbie | 1.7 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0Initial program 64.0
rmApplied *-un-lft-identity_binary64_996764.0
Applied times-frac_binary64_99730.1
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -1.14671052782427018e84Initial program 0.2
Taylor expanded around 0 0.2
if -1.14671052782427018e84 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 9.8
rmApplied associate-/l*_binary64_99122.2
Final simplification1.7
herbie shell --seed 2021093
(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))