\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 5.33138373 \cdot 10^{-316}:\\
\;\;\;\;\begin{array}{l}
t_0 := \sqrt[3]{\mathsf{fma}\left(z, z, z\right)}\\
\left(x \cdot \frac{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{t_0 \cdot t_0}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{\frac{\sqrt[3]{y}}{t_0}}{\sqrt[3]{z}}
\end{array}\\
\mathbf{elif}\;x \cdot y \leq 4.090115811618418 \cdot 10^{+300}:\\
\;\;\;\;\frac{x \cdot y}{\mathsf{fma}\left(z, z, z\right)} \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \left(x \cdot \frac{y}{z \cdot z}\right)\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
(FPCore (x y z)
:precision binary64
(if (<= (* x y) 5.33138373e-316)
(let* ((t_0 (cbrt (fma z z z))))
(*
(* x (/ (/ (* (cbrt y) (cbrt y)) (* t_0 t_0)) (* (cbrt z) (cbrt z))))
(/ (/ (cbrt y) t_0) (cbrt z))))
(if (<= (* x y) 4.090115811618418e+300)
(* (/ (* x y) (fma z z z)) (/ 1.0 z))
(* (/ 1.0 z) (* x (/ y (* z 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 ((x * y) <= 5.33138373e-316) {
double t_0_1 = cbrt(fma(z, z, z));
tmp = (x * (((cbrt(y) * cbrt(y)) / (t_0_1 * t_0_1)) / (cbrt(z) * cbrt(z)))) * ((cbrt(y) / t_0_1) / cbrt(z));
} else if ((x * y) <= 4.090115811618418e+300) {
tmp = ((x * y) / fma(z, z, z)) * (1.0 / z);
} else {
tmp = (1.0 / z) * (x * (y / (z * z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 14.5 |
|---|---|
| Target | 4.2 |
| Herbie | 3.3 |
if (*.f64 x y) < 5.33138373e-316Initial program 16.6
Simplified8.3
Applied add-cube-cbrt_binary648.7
Applied add-cube-cbrt_binary648.9
Applied add-cube-cbrt_binary649.0
Applied times-frac_binary649.0
Applied times-frac_binary649.0
Applied associate-*r*_binary643.8
if 5.33138373e-316 < (*.f64 x y) < 4.09011581161841797e300Initial program 7.3
Simplified7.5
Applied div-inv_binary647.5
Applied associate-*r*_binary643.2
Applied associate-*r/_binary640.9
Simplified0.9
if 4.09011581161841797e300 < (*.f64 x y) Initial program 61.2
Simplified19.1
Applied div-inv_binary6419.1
Applied associate-*r*_binary6421.7
Taylor expanded in z around inf 21.8
Simplified21.8
Final simplification3.3
herbie shell --seed 2021220
(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))))