\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;\left(z \cdot z\right) \cdot \left(z + 1\right) \leq 2.4348500591964066 \cdot 10^{+210}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{\mathsf{fma}\left(z, z, z\right)}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \mathsf{hypot}\left(z, \sqrt{z}\right)\\
\frac{1}{t_0} \cdot \left(\frac{y}{t_0} \cdot \frac{x}{z}\right)
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
(FPCore (x y z) :precision binary64 (if (<= (* (* z z) (+ z 1.0)) 2.4348500591964066e+210) (* (/ y z) (/ x (fma z z z))) (let* ((t_0 (hypot z (sqrt z)))) (* (/ 1.0 t_0) (* (/ y t_0) (/ x z))))))
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 tmp;
if (((z * z) * (z + 1.0)) <= 2.4348500591964066e+210) {
tmp = (y / z) * (x / fma(z, z, z));
} else {
double t_0 = hypot(z, sqrt(z));
tmp = (1.0 / t_0) * ((y / t_0) * (x / z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 15.3 |
|---|---|
| Target | 4.3 |
| Herbie | 4.2 |
if (*.f64 (*.f64 z z) (+.f64 z 1)) < 2.43485005919640658e210Initial program 16.2
Simplified10.0
Applied associate-*r/_binary645.4
Applied associate-/l*_binary649.6
Applied associate-/r/_binary649.6
Applied *-un-lft-identity_binary649.6
Applied times-frac_binary645.6
Simplified5.5
if 2.43485005919640658e210 < (*.f64 (*.f64 z z) (+.f64 z 1)) Initial program 12.8
Simplified6.0
Applied associate-*r/_binary644.9
Applied associate-/l*_binary646.1
Applied add-sqr-sqrt_binary646.1
Applied *-un-lft-identity_binary646.1
Applied times-frac_binary646.1
Applied *-un-lft-identity_binary646.1
Applied times-frac_binary646.1
Applied *-un-lft-identity_binary646.1
Applied times-frac_binary645.0
Simplified5.0
Simplified0.7
Final simplification4.2
herbie shell --seed 2022088
(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))))