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




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 14.7 |
|---|---|
| Target | 4.2 |
| Herbie | 3.2 |
if (*.f64 x y) < -1.3650421800487005e-257Initial program 12.8
Simplified8.9
Applied *-un-lft-identity_binary648.9
Applied add-cube-cbrt_binary649.4
Applied add-sqr-sqrt_binary649.4
Applied times-frac_binary649.4
Applied times-frac_binary649.4
Applied associate-*r*_binary643.9
if -1.3650421800487005e-257 < (*.f64 x y) < 6.5683273668649002e-238Initial program 20.8
Simplified5.6
Taylor expanded in z around 0 21.8
Simplified1.2
if 6.5683273668649002e-238 < (*.f64 x y) Initial program 12.9
Simplified9.5
Applied *-un-lft-identity_binary649.5
Applied add-cube-cbrt_binary649.9
Applied add-cube-cbrt_binary6410.0
Applied times-frac_binary6410.0
Applied times-frac_binary6410.0
Applied associate-*r*_binary643.7
Simplified3.7
Final simplification3.2
herbie shell --seed 2022125
(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))))