\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq -\infty:\\
\;\;\;\;\frac{x}{\sqrt[3]{{\left(\frac{z}{y + z}\right)}^{3}}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq -5.336206498650438 \cdot 10^{+99}:\\
\;\;\;\;x + \frac{x \cdot y}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 7.381013021528955 \cdot 10^{-16}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 2.802615316481958 \cdot 10^{+267}:\\
\;\;\;\;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 (cbrt (pow (/ z (+ y z)) 3.0)))
(if (<= (/ (* x (+ y z)) z) -5.336206498650438e+99)
(+ x (/ (* x y) z))
(if (<= (/ (* x (+ y z)) z) 7.381013021528955e-16)
(* x (/ (+ y z) z))
(if (<= (/ (* x (+ y z)) z) 2.802615316481958e+267)
(+ 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 / cbrt(pow((z / (y + z)), 3.0));
} else if (((x * (y + z)) / z) <= -5.336206498650438e+99) {
tmp = x + ((x * y) / z);
} else if (((x * (y + z)) / z) <= 7.381013021528955e-16) {
tmp = x * ((y + z) / z);
} else if (((x * (y + z)) / z) <= 2.802615316481958e+267) {
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.3 |
| Herbie | 0.8 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0Initial program 64.0
rmApplied associate-/l*_binary64_102530.0
Simplified0.0
rmApplied add-cbrt-cube_binary64_103441.7
Simplified1.7
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -5.3362064986504381e99 or 7.3810130215289555e-16 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.8026153164819579e267Initial program 0.2
rmApplied *-un-lft-identity_binary64_103080.2
Applied times-frac_binary64_103148.7
Simplified8.7
Simplified8.7
Taylor expanded around 0 0.2
if -5.3362064986504381e99 < (/.f64 (*.f64 x (+.f64 y z)) z) < 7.3810130215289555e-16Initial program 5.8
rmApplied *-un-lft-identity_binary64_103085.8
Applied times-frac_binary64_103140.6
Simplified0.6
Simplified0.6
if 2.8026153164819579e267 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 49.8
rmApplied associate-/l*_binary64_102533.3
Final simplification0.8
herbie shell --seed 2021098
(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))