\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq -2.0130703549749886 \cdot 10^{+249}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq -6.019602592663955 \cdot 10^{-146}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 2.4021532079817052 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 6.841831142745054 \cdot 10^{+291}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(if (<= (/ (* x (+ y z)) z) -2.0130703549749886e+249)
(* x (/ (+ y z) z))
(if (<= (/ (* x (+ y z)) z) -6.019602592663955e-146)
(/ (* x (+ y z)) z)
(if (<= (/ (* x (+ y z)) z) 2.4021532079817052e+29)
(/ x (/ z (+ y z)))
(if (<= (/ (* x (+ y z)) z) 6.841831142745054e+291)
(/ (* x (+ y z)) z)
(* x (/ (+ y z) 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) <= -2.0130703549749886e+249) {
tmp = x * ((y + z) / z);
} else if (((x * (y + z)) / z) <= -6.019602592663955e-146) {
tmp = (x * (y + z)) / z;
} else if (((x * (y + z)) / z) <= 2.4021532079817052e+29) {
tmp = x / (z / (y + z));
} else if (((x * (y + z)) / z) <= 6.841831142745054e+291) {
tmp = (x * (y + z)) / z;
} else {
tmp = x * ((y + z) / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 3.1 |
| Herbie | 0.8 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -2.0130703549749886e249 or 6.8418311427450543e291 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 50.3
rmApplied *-un-lft-identity_binary64_1187250.3
Applied times-frac_binary64_118783.7
Simplified3.7
if -2.0130703549749886e249 < (/.f64 (*.f64 x (+.f64 y z)) z) < -6.0196025926639548e-146 or 2.40215320798170521e29 < (/.f64 (*.f64 x (+.f64 y z)) z) < 6.8418311427450543e291Initial program 0.2
if -6.0196025926639548e-146 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.40215320798170521e29Initial program 8.5
rmApplied associate-/l*_binary64_118190.1
Final simplification0.8
herbie shell --seed 2020281
(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))