\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\begin{array}{l}
\mathbf{if}\;x \cdot y \le -138596582542956773000:\\
\;\;\;\;\frac{\left(x \cdot \frac{y}{z}\right) \cdot \frac{1}{z}}{z + 1}\\
\mathbf{elif}\;x \cdot y \le 9.5201024367058361 \cdot 10^{151}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot y}{\left(z + 1\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z + 1}{\frac{y}{z}}}\\
\end{array}double code(double x, double y, double z) {
return ((x * y) / ((z * z) * (z + 1.0)));
}
double code(double x, double y, double z) {
double VAR;
if (((x * y) <= -1.3859658254295677e+20)) {
VAR = (((x * (y / z)) * (1.0 / z)) / (z + 1.0));
} else {
double VAR_1;
if (((x * y) <= 9.520102436705836e+151)) {
VAR_1 = (((x / z) * y) / ((z + 1.0) * z));
} else {
VAR_1 = ((x / z) / ((z + 1.0) / (y / z)));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 14.6 |
|---|---|
| Target | 4.0 |
| Herbie | 2.6 |
if (* x y) < -1.3859658254295677e+20Initial program 18.0
rmApplied associate-/r*13.2
rmApplied times-frac3.1
rmApplied div-inv3.1
Applied associate-*r*4.1
Simplified4.2
if -1.3859658254295677e+20 < (* x y) < 9.520102436705836e+151Initial program 11.2
rmApplied associate-/r*10.6
rmApplied times-frac2.8
rmApplied associate-*r/2.2
Applied associate-/l/2.2
if 9.520102436705836e+151 < (* x y) Initial program 33.1
rmApplied associate-/r*27.1
rmApplied times-frac2.2
Applied associate-/l*2.6
Final simplification2.6
herbie shell --seed 2020092 +o rules:numerics
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1))))