\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq -4.94852375797022 \cdot 10^{+130}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\
\mathbf{elif}\;\frac{x \cdot \left(y + z\right)}{z} \leq 397704063456036.7 \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \leq 9.914216908054568 \cdot 10^{+238}\right):\\
\;\;\;\;x \cdot \left(1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{1}{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) -4.94852375797022e+130)
(* (+ y z) (/ x z))
(if (or (<= (/ (* x (+ y z)) z) 397704063456036.7)
(not (<= (/ (* x (+ y z)) z) 9.914216908054568e+238)))
(* x (+ 1.0 (/ y z)))
(* (/ 1.0 z) (/ x (/ 1.0 (+ 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) <= -4.94852375797022e+130) {
tmp = (y + z) * (x / z);
} else if ((((x * (y + z)) / z) <= 397704063456036.7) || !(((x * (y + z)) / z) <= 9.914216908054568e+238)) {
tmp = x * (1.0 + (y / z));
} else {
tmp = (1.0 / z) * (x / (1.0 / (y + z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 11.8 |
|---|---|
| Target | 2.8 |
| Herbie | 2.3 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -4.9485237579702195e130Initial program 26.1
rmApplied associate-/l*_binary64_105946.3
Simplified6.3
rmApplied associate-/r/_binary64_105957.9
if -4.9485237579702195e130 < (/.f64 (*.f64 x (+.f64 y z)) z) < 397704063456036.688 or 9.91421690805456754e238 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 10.7
rmApplied associate-/l*_binary64_105941.1
Simplified1.1
rmApplied div-inv_binary64_106461.3
Simplified1.3
if 397704063456036.688 < (/.f64 (*.f64 x (+.f64 y z)) z) < 9.91421690805456754e238Initial program 0.2
rmApplied associate-/l*_binary64_105945.6
Simplified5.6
rmApplied div-inv_binary64_106465.7
Applied *-un-lft-identity_binary64_106495.7
Applied times-frac_binary64_106550.3
Final simplification2.3
herbie shell --seed 2021044
(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))