\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
t_0 := \frac{\frac{1}{z}}{\frac{z \cdot \frac{z}{y}}{x}}\\
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot y \leq -3.2880636115797007 \cdot 10^{-102}:\\
\;\;\;\;\frac{{\left(\frac{\mathsf{fma}\left(z, z, z\right)}{x \cdot y}\right)}^{-1}}{z}\\
\mathbf{elif}\;x \cdot y \leq 3.290464648854404 \cdot 10^{-127}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{\mathsf{fma}\left(z, z, z\right)}\\
\mathbf{elif}\;x \cdot y \leq 8.738469963482544 \cdot 10^{+280}:\\
\;\;\;\;\frac{\frac{x \cdot y}{z + {z}^{2}}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (/ 1.0 z) (/ (* z (/ z y)) x))))
(if (<= (* x y) (- INFINITY))
t_0
(if (<= (* x y) -3.2880636115797007e-102)
(/ (pow (/ (fma z z z) (* x y)) -1.0) z)
(if (<= (* x y) 3.290464648854404e-127)
(* (/ x z) (/ y (fma z z z)))
(if (<= (* x y) 8.738469963482544e+280)
(/ (/ (* x y) (+ z (pow z 2.0))) z)
t_0))))))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 t_0 = (1.0 / z) / ((z * (z / y)) / x);
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = t_0;
} else if ((x * y) <= -3.2880636115797007e-102) {
tmp = pow((fma(z, z, z) / (x * y)), -1.0) / z;
} else if ((x * y) <= 3.290464648854404e-127) {
tmp = (x / z) * (y / fma(z, z, z));
} else if ((x * y) <= 8.738469963482544e+280) {
tmp = ((x * y) / (z + pow(z, 2.0))) / z;
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 15.1 |
|---|---|
| Target | 4.0 |
| Herbie | 1.5 |
if (*.f64 x y) < -inf.0 or 8.738469963482544e280 < (*.f64 x y) Initial program 59.9
Simplified20.2
Applied egg-rr22.5
Applied egg-rr22.5
Applied egg-rr21.9
Taylor expanded in z around inf 22.3
Simplified5.3
if -inf.0 < (*.f64 x y) < -3.28806361157970073e-102Initial program 5.6
Simplified7.6
Applied egg-rr4.4
Applied egg-rr1.6
if -3.28806361157970073e-102 < (*.f64 x y) < 3.290464648854404e-127Initial program 17.3
Simplified7.0
Applied egg-rr2.3
Applied egg-rr0.9
if 3.290464648854404e-127 < (*.f64 x y) < 8.738469963482544e280Initial program 5.2
Simplified7.6
Applied egg-rr4.1
Taylor expanded in x around 0 1.0
Final simplification1.5
herbie shell --seed 2022130
(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))))