\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.5092920853377696 \cdot 10^{-17}:\\
\;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 6.152532775435718 \cdot 10^{+84}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 5.489864442456623 \cdot 10^{+286}:\\
\;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{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) (- INFINITY))
(/ x (/ z (+ y z)))
(if (<= (/ (* x (+ y z)) z) -3.5092920853377696e-17)
(* (* x (+ y z)) (/ 1.0 z))
(if (<= (/ (* x (+ y z)) z) 6.152532775435718e+84)
(/ x (/ z (+ y z)))
(if (<= (/ (* x (+ y z)) z) 5.489864442456623e+286)
(* (* x (+ y z)) (/ 1.0 z))
(* x (/ (+ y z) z)))))))double code(double x, double y, double z) {
return (((double) (x * ((double) (y + z)))) / z);
}
double code(double x, double y, double z) {
double tmp;
if (((((double) (x * ((double) (y + z)))) / z) <= ((double) -(((double) INFINITY))))) {
tmp = (x / (z / ((double) (y + z))));
} else {
double tmp_1;
if (((((double) (x * ((double) (y + z)))) / z) <= -3.5092920853377696e-17)) {
tmp_1 = ((double) (((double) (x * ((double) (y + z)))) * (1.0 / z)));
} else {
double tmp_2;
if (((((double) (x * ((double) (y + z)))) / z) <= 6.152532775435718e+84)) {
tmp_2 = (x / (z / ((double) (y + z))));
} else {
double tmp_3;
if (((((double) (x * ((double) (y + z)))) / z) <= 5.489864442456623e+286)) {
tmp_3 = ((double) (((double) (x * ((double) (y + z)))) * (1.0 / z)));
} else {
tmp_3 = ((double) (x * (((double) (y + z)) / z)));
}
tmp_2 = tmp_3;
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.9 |
|---|---|
| Target | 3.3 |
| Herbie | 0.4 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0 or -3.5092920853377696e-17 < (/.f64 (*.f64 x (+.f64 y z)) z) < 6.1525327754357176e84Initial program 14.0
rmApplied associate-/l*_binary640.3
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -3.5092920853377696e-17 or 6.1525327754357176e84 < (/.f64 (*.f64 x (+.f64 y z)) z) < 5.4898644424566233e286Initial program 0.2
rmApplied div-inv_binary640.3
if 5.4898644424566233e286 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 57.3
rmApplied *-un-lft-identity_binary6457.3
Applied times-frac_binary641.9
Simplified1.9
Final simplification0.4
herbie shell --seed 2020205
(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))