\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 6.638278301525652 \cdot 10^{-131}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z + 1}\\
\mathbf{elif}\;x \cdot y \leq 3.184511130325532 \cdot 10^{+168}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z \cdot \left(z \cdot \left(z + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\left(z + 1\right) \cdot \frac{z}{y}}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
(FPCore (x y z)
:precision binary64
(if (<= (* x y) 6.638278301525652e-131)
(* (/ x z) (/ (/ y z) (+ z 1.0)))
(if (<= (* x y) 3.184511130325532e+168)
(* (* x y) (/ 1.0 (* z (* z (+ z 1.0)))))
(/ (/ x z) (* (+ z 1.0) (/ z y))))))double code(double x, double y, double z) {
return (((double) (x * y)) / ((double) (((double) (z * z)) * ((double) (z + 1.0)))));
}
double code(double x, double y, double z) {
double tmp;
if ((((double) (x * y)) <= 6.638278301525652e-131)) {
tmp = ((double) ((x / z) * ((y / z) / ((double) (z + 1.0)))));
} else {
double tmp_1;
if ((((double) (x * y)) <= 3.184511130325532e+168)) {
tmp_1 = ((double) (((double) (x * y)) * (1.0 / ((double) (z * ((double) (z * ((double) (z + 1.0)))))))));
} else {
tmp_1 = ((x / z) / ((double) (((double) (z + 1.0)) * (z / y))));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 14.8 |
|---|---|
| Target | 4.0 |
| Herbie | 2.8 |
if (* x y) < 6.6382783015256524e-131Initial program Error: 15.7 bits
SimplifiedError: 13.9 bits
rmApplied *-un-lft-identityError: 13.9 bits
Applied times-fracError: 8.1 bits
Applied associate-*r*Error: 3.9 bits
SimplifiedError: 3.8 bits
rmApplied associate-/r*Error: 2.6 bits
if 6.6382783015256524e-131 < (* x y) < 3.184511130325532e168Initial program Error: 3.6 bits
SimplifiedError: 9.7 bits
rmApplied div-invError: 9.8 bits
Applied associate-*r*Error: 3.8 bits
if 3.184511130325532e168 < (* x y) Initial program Error: 33.9 bits
SimplifiedError: 22.8 bits
rmApplied *-un-lft-identityError: 22.8 bits
Applied times-fracError: 14.3 bits
Applied associate-*r*Error: 11.9 bits
SimplifiedError: 11.9 bits
rmApplied clear-numError: 11.9 bits
SimplifiedError: 2.7 bits
rmApplied un-div-invError: 2.6 bits
Final simplificationError: 2.8 bits
herbie shell --seed 2020204
(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.0 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1.0))))