\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}{\frac{z}{y + z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq -3.949073247736926 \cdot 10^{+55}:\\
\;\;\;\;x + \frac{x \cdot y}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 0:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 6.0762204890108674 \cdot 10^{+293}:\\
\;\;\;\;x + \frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{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 (/ z (+ y z)))
(if (<= (/ (* x (+ y z)) z) -3.949073247736926e+55)
(+ x (/ (* x y) z))
(if (<= (/ (* x (+ y z)) z) 0.0)
(/ x (/ z (+ y z)))
(if (<= (/ (* x (+ y z)) z) 6.0762204890108674e+293)
(+ x (/ (* x y) z))
(* (+ y z) (/ 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 (((x * (y + z)) / z) <= -((double) INFINITY)) {
tmp = x / (z / (y + z));
} else if (((x * (y + z)) / z) <= -3.949073247736926e+55) {
tmp = x + ((x * y) / z);
} else if (((x * (y + z)) / z) <= 0.0) {
tmp = x / (z / (y + z));
} else if (((x * (y + z)) / z) <= 6.0762204890108674e+293) {
tmp = x + ((x * y) / z);
} else {
tmp = (y + z) * (x / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 3.1 |
| Herbie | 0.3 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0 or -3.94907324773692607e55 < (/.f64 (*.f64 x (+.f64 y z)) z) < -0.0Initial program 20.1
rmApplied associate-/l*_binary64_124930.2
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -3.94907324773692607e55 or -0.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < 6.07622048901086744e293Initial program 0.4
Taylor expanded around 0 0.3
if 6.07622048901086744e293 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 59.8
rmApplied associate-/l*_binary64_124931.4
rmApplied associate-/r/_binary64_124941.5
Final simplification0.3
herbie shell --seed 2020303
(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))