(FPCore (cosTheta c)
:precision binary64
(/
1.0
(+
(+ 1.0 c)
(*
(* (/ 1.0 (sqrt PI)) (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta))
(exp (* (- cosTheta) cosTheta))))))(FPCore (cosTheta c)
:precision binary64
(let* ((t_0 (sqrt (- 1.0 (+ cosTheta cosTheta)))) (t_1 (pow (sqrt PI) -1.0)))
(/
1.0
(+
(+ 1.0 c)
(*
(if (!= t_1 0.0) (/ t_0 (/ cosTheta t_1)) (/ (/ t_0 (sqrt PI)) cosTheta))
(exp (* (- cosTheta) cosTheta)))))))double code(double cosTheta, double c) {
return 1.0 / ((1.0 + c) + (((1.0 / sqrt(((double) M_PI))) * (sqrt(((1.0 - cosTheta) - cosTheta)) / cosTheta)) * exp((-cosTheta * cosTheta))));
}
double code(double cosTheta, double c) {
double t_0 = sqrt((1.0 - (cosTheta + cosTheta)));
double t_1 = pow(sqrt(((double) M_PI)), -1.0);
double tmp;
if (t_1 != 0.0) {
tmp = t_0 / (cosTheta / t_1);
} else {
tmp = (t_0 / sqrt(((double) M_PI))) / cosTheta;
}
return 1.0 / ((1.0 + c) + (tmp * exp((-cosTheta * cosTheta))));
}
public static double code(double cosTheta, double c) {
return 1.0 / ((1.0 + c) + (((1.0 / Math.sqrt(Math.PI)) * (Math.sqrt(((1.0 - cosTheta) - cosTheta)) / cosTheta)) * Math.exp((-cosTheta * cosTheta))));
}
public static double code(double cosTheta, double c) {
double t_0 = Math.sqrt((1.0 - (cosTheta + cosTheta)));
double t_1 = Math.pow(Math.sqrt(Math.PI), -1.0);
double tmp;
if (t_1 != 0.0) {
tmp = t_0 / (cosTheta / t_1);
} else {
tmp = (t_0 / Math.sqrt(Math.PI)) / cosTheta;
}
return 1.0 / ((1.0 + c) + (tmp * Math.exp((-cosTheta * cosTheta))));
}
def code(cosTheta, c): return 1.0 / ((1.0 + c) + (((1.0 / math.sqrt(math.pi)) * (math.sqrt(((1.0 - cosTheta) - cosTheta)) / cosTheta)) * math.exp((-cosTheta * cosTheta))))
def code(cosTheta, c): t_0 = math.sqrt((1.0 - (cosTheta + cosTheta))) t_1 = math.pow(math.sqrt(math.pi), -1.0) tmp = 0 if t_1 != 0.0: tmp = t_0 / (cosTheta / t_1) else: tmp = (t_0 / math.sqrt(math.pi)) / cosTheta return 1.0 / ((1.0 + c) + (tmp * math.exp((-cosTheta * cosTheta))))
function code(cosTheta, c) return Float64(1.0 / Float64(Float64(1.0 + c) + Float64(Float64(Float64(1.0 / sqrt(pi)) * Float64(sqrt(Float64(Float64(1.0 - cosTheta) - cosTheta)) / cosTheta)) * exp(Float64(Float64(-cosTheta) * cosTheta))))) end
function code(cosTheta, c) t_0 = sqrt(Float64(1.0 - Float64(cosTheta + cosTheta))) t_1 = sqrt(pi) ^ -1.0 tmp = 0.0 if (t_1 != 0.0) tmp = Float64(t_0 / Float64(cosTheta / t_1)); else tmp = Float64(Float64(t_0 / sqrt(pi)) / cosTheta); end return Float64(1.0 / Float64(Float64(1.0 + c) + Float64(tmp * exp(Float64(Float64(-cosTheta) * cosTheta))))) end
function tmp = code(cosTheta, c) tmp = 1.0 / ((1.0 + c) + (((1.0 / sqrt(pi)) * (sqrt(((1.0 - cosTheta) - cosTheta)) / cosTheta)) * exp((-cosTheta * cosTheta)))); end
function tmp_2 = code(cosTheta, c) t_0 = sqrt((1.0 - (cosTheta + cosTheta))); t_1 = sqrt(pi) ^ -1.0; tmp = 0.0; if (t_1 ~= 0.0) tmp = t_0 / (cosTheta / t_1); else tmp = (t_0 / sqrt(pi)) / cosTheta; end tmp_2 = 1.0 / ((1.0 + c) + (tmp * exp((-cosTheta * cosTheta)))); end
code[cosTheta_, c_] := N[(1.0 / N[(N[(1.0 + c), $MachinePrecision] + N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[(1.0 - cosTheta), $MachinePrecision] - cosTheta), $MachinePrecision]], $MachinePrecision] / cosTheta), $MachinePrecision]), $MachinePrecision] * N[Exp[N[((-cosTheta) * cosTheta), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[cosTheta_, c_] := Block[{t$95$0 = N[Sqrt[N[(1.0 - N[(cosTheta + cosTheta), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[Pi], $MachinePrecision], -1.0], $MachinePrecision]}, N[(1.0 / N[(N[(1.0 + c), $MachinePrecision] + N[(If[Unequal[t$95$1, 0.0], N[(t$95$0 / N[(cosTheta / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] / cosTheta), $MachinePrecision]] * N[Exp[N[((-cosTheta) * cosTheta), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \frac{\sqrt{\left(1 - cosTheta\right) - cosTheta}}{cosTheta}\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\begin{array}{l}
t_0 := \sqrt{1 - \left(cosTheta + cosTheta\right)}\\
t_1 := {\left(\sqrt{\pi}\right)}^{-1}\\
\frac{1}{\left(1 + c\right) + \begin{array}{l}
\mathbf{if}\;t_1 \ne 0:\\
\;\;\;\;\frac{t_0}{\frac{cosTheta}{t_1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{\sqrt{\pi}}}{cosTheta}\\
\end{array} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\end{array}
Initial program 99.4%
Applied egg-rr99.4%
Simplified99.5%
Applied egg-rr99.6%
herbie shell --seed 2023187
(FPCore (cosTheta c)
:name "Beckmann Sample, normalization factor"
:precision binary64
:pre (and (and (< 0.0 cosTheta) (< cosTheta 0.9999)) (and (< -1.0 c) (< c 1.0)))
(/ 1.0 (+ (+ 1.0 c) (* (* (/ 1.0 (sqrt PI)) (/ (sqrt (- (- 1.0 cosTheta) cosTheta)) cosTheta)) (exp (* (- cosTheta) cosTheta))))))