\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 -5.763559018099662 \cdot 10^{+29}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{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) -5.763559018099662e+29)
(/ (* x (+ y z)) 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) <= -5.763559018099662e+29) {
tmp = (x * (y + z)) / z;
} else {
tmp = x / (z / (y + z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 11.8 |
|---|---|
| Target | 3.0 |
| Herbie | 1.5 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0Initial program 64.0
rmApplied *-un-lft-identity_binary64_1201364.0
Applied times-frac_binary64_120190.1
Simplified0.1
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -5.76355901809966183e29Initial program 0.2
if -5.76355901809966183e29 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 9.6
rmApplied associate-/l*_binary64_119581.9
Final simplification1.5
herbie shell --seed 2020355
(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))