(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (hypot 1.0 z) (sqrt y))))
(if (<= (* y (+ 1.0 (* z z))) 6.67452746661305e-205)
(/ (/ (* (pow x -1.0) (/ 1.0 y)) (hypot 1.0 z)) (hypot 1.0 z))
(* (/ 1.0 t_0) (/ (/ 1.0 x) t_0)))))double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
double code(double x, double y, double z) {
double t_0 = hypot(1.0, z) * sqrt(y);
double tmp;
if ((y * (1.0 + (z * z))) <= 6.67452746661305e-205) {
tmp = ((pow(x, -1.0) * (1.0 / y)) / hypot(1.0, z)) / hypot(1.0, z);
} else {
tmp = (1.0 / t_0) * ((1.0 / x) / t_0);
}
return tmp;
}
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
public static double code(double x, double y, double z) {
double t_0 = Math.hypot(1.0, z) * Math.sqrt(y);
double tmp;
if ((y * (1.0 + (z * z))) <= 6.67452746661305e-205) {
tmp = ((Math.pow(x, -1.0) * (1.0 / y)) / Math.hypot(1.0, z)) / Math.hypot(1.0, z);
} else {
tmp = (1.0 / t_0) * ((1.0 / x) / t_0);
}
return tmp;
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
def code(x, y, z): t_0 = math.hypot(1.0, z) * math.sqrt(y) tmp = 0 if (y * (1.0 + (z * z))) <= 6.67452746661305e-205: tmp = ((math.pow(x, -1.0) * (1.0 / y)) / math.hypot(1.0, z)) / math.hypot(1.0, z) else: tmp = (1.0 / t_0) * ((1.0 / x) / t_0) return tmp
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function code(x, y, z) t_0 = Float64(hypot(1.0, z) * sqrt(y)) tmp = 0.0 if (Float64(y * Float64(1.0 + Float64(z * z))) <= 6.67452746661305e-205) tmp = Float64(Float64(Float64((x ^ -1.0) * Float64(1.0 / y)) / hypot(1.0, z)) / hypot(1.0, z)); else tmp = Float64(Float64(1.0 / t_0) * Float64(Float64(1.0 / x) / t_0)); end return tmp end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
function tmp_2 = code(x, y, z) t_0 = hypot(1.0, z) * sqrt(y); tmp = 0.0; if ((y * (1.0 + (z * z))) <= 6.67452746661305e-205) tmp = (((x ^ -1.0) * (1.0 / y)) / hypot(1.0, z)) / hypot(1.0, z); else tmp = (1.0 / t_0) * ((1.0 / x) / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 6.67452746661305e-205], N[(N[(N[(N[Power[x, -1.0], $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\\
\mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 6.67452746661305 \cdot 10^{-205}:\\
\;\;\;\;\frac{\frac{{x}^{-1} \cdot \frac{1}{y}}{\mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0} \cdot \frac{\frac{1}{x}}{t_0}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.1 |
|---|---|
| Target | 4.7 |
| Herbie | 1.3 |
if (*.f64 y (+.f64 1 (*.f64 z z))) < 6.6745274666130502e-205Initial program 4.2
Applied egg-rr6.6
Applied egg-rr3.6
Applied egg-rr3.4
if 6.6745274666130502e-205 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 6.9
Applied egg-rr0.4
Final simplification1.3
herbie shell --seed 2022153
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))