(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (* z z) (+ z 1.0))) (t_1 (hypot z (sqrt z))))
(if (<= t_0 0.0)
(* (/ 1.0 z) (/ (/ x (fma z z z)) (/ 1.0 y)))
(if (<= t_0 1e+300)
(/ x (* (fma z z z) (/ z y)))
(/ (/ (* x (/ y z)) t_1) t_1)))))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 = (z * z) * (z + 1.0);
double t_1 = hypot(z, sqrt(z));
double tmp;
if (t_0 <= 0.0) {
tmp = (1.0 / z) * ((x / fma(z, z, z)) / (1.0 / y));
} else if (t_0 <= 1e+300) {
tmp = x / (fma(z, z, z) * (z / y));
} else {
tmp = ((x * (y / z)) / t_1) / t_1;
}
return tmp;
}
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function code(x, y, z) t_0 = Float64(Float64(z * z) * Float64(z + 1.0)) t_1 = hypot(z, sqrt(z)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(1.0 / z) * Float64(Float64(x / fma(z, z, z)) / Float64(1.0 / y))); elseif (t_0 <= 1e+300) tmp = Float64(x / Float64(fma(z, z, z) * Float64(z / y))); else tmp = Float64(Float64(Float64(x * Float64(y / z)) / t_1) / t_1); end return tmp end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[z ^ 2 + N[Sqrt[z], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(x / N[(z * z + z), $MachinePrecision]), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+300], N[(x / N[(N[(z * z + z), $MachinePrecision] * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
t_0 := \left(z \cdot z\right) \cdot \left(z + 1\right)\\
t_1 := \mathsf{hypot}\left(z, \sqrt{z}\right)\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{x}{\mathsf{fma}\left(z, z, z\right)}}{\frac{1}{y}}\\
\mathbf{elif}\;t_0 \leq 10^{+300}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(z, z, z\right) \cdot \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \frac{y}{z}}{t_1}}{t_1}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 14.3 |
|---|---|
| Target | 4.2 |
| Herbie | 4.5 |
if (*.f64 (*.f64 z z) (+.f64 z 1)) < 0.0Initial program 21.7
Simplified5.0
Applied egg-rr5.0
Applied egg-rr4.7
if 0.0 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 1.0000000000000001e300Initial program 6.5
Simplified5.4
Applied egg-rr5.5
Applied egg-rr6.5
if 1.0000000000000001e300 < (*.f64 (*.f64 z z) (+.f64 z 1)) Initial program 13.2
Simplified5.6
Applied egg-rr1.1
Final simplification4.5
herbie shell --seed 2022166
(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))))