\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq -\infty:\\
\;\;\;\;x + \frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq -4.106270057463767 \cdot 10^{+124}:\\
\;\;\;\;x + \frac{1}{z} \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 1.6771279090950563 \cdot 10^{-155}:\\
\;\;\;\;x + \frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 7.536776844305155 \cdot 10^{+301}:\\
\;\;\;\;x + \frac{1}{z} \cdot \left(x \cdot y\right)\\
\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 (+ y z)) z) (- INFINITY))
(+ x (/ x (/ z y)))
(if (<= (/ (* x (+ y z)) z) -4.106270057463767e+124)
(+ x (* (/ 1.0 z) (* x y)))
(if (<= (/ (* x (+ y z)) z) 1.6771279090950563e-155)
(+ x (/ x (/ z y)))
(if (<= (/ (* x (+ y z)) z) 7.536776844305155e+301)
(+ x (* (/ 1.0 z) (* x y)))
(+ 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 * (y + z)) / z) <= -((double) INFINITY)) {
tmp = x + (x / (z / y));
} else if (((x * (y + z)) / z) <= -4.106270057463767e+124) {
tmp = x + ((1.0 / z) * (x * y));
} else if (((x * (y + z)) / z) <= 1.6771279090950563e-155) {
tmp = x + (x / (z / y));
} else if (((x * (y + z)) / z) <= 7.536776844305155e+301) {
tmp = x + ((1.0 / z) * (x * y));
} else {
tmp = x + (x * (y / z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.9 |
|---|---|
| Target | 3.0 |
| Herbie | 0.5 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0 or -4.10627005746376719e124 < (/.f64 (*.f64 x (+.f64 y z)) z) < 1.67712790909505627e-155Initial program 16.4
Simplified0.6
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -4.10627005746376719e124 or 1.67712790909505627e-155 < (/.f64 (*.f64 x (+.f64 y z)) z) < 7.5367768443051555e301Initial program 0.3
Simplified6.0
rmApplied div-inv_binary64_72366.0
Applied *-un-lft-identity_binary64_72396.0
Applied times-frac_binary64_72450.3
Simplified0.3
if 7.5367768443051555e301 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 61.4
Simplified0.6
Final simplification0.5
herbie shell --seed 2021176
(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))