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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 3.0 |
| Herbie | 3.5 |
if y < -7.4301304915614058e46Initial program 13.0
rmApplied associate-/l*_binary648.3
rmApplied associate-/r/_binary6410.6
if -7.4301304915614058e46 < y < 1.1477876828940585e239Initial program 11.8
rmApplied associate-/l*_binary641.3
if 1.1477876828940585e239 < y Initial program 16.4
Taylor expanded around 0 16.0
Simplified16.0
Final simplification3.5
herbie shell --seed 2020224
(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))