\[\left(0 < cosTheta \land cosTheta < 0.9999\right) \land \left(-1 < c \land c < 1\right)\]
\[\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 := \mathsf{fma}\left(c, c, 1 - c\right)\\
t_1 := t_0 \cdot cosTheta\\
t_2 := \sqrt{1 - cosTheta \cdot 2}\\
\mathbf{if}\;t_1 \ne 0:\\
\;\;\;\;\frac{t_1}{\mathsf{fma}\left(\frac{\frac{t_2}{e^{{cosTheta}^{2}}}}{\sqrt{\pi}}, t_0, {c}^{3} \cdot cosTheta + cosTheta\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{fma}\left(\frac{t_2}{\sqrt{\pi} \cdot cosTheta}, e^{-{cosTheta}^{2}}, c - -1\right)\right)}^{-1}\\
\end{array}
\]
(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 (fma c c (- 1.0 c)))
(t_1 (* t_0 cosTheta))
(t_2 (sqrt (- 1.0 (* cosTheta 2.0)))))
(if (!= t_1 0.0)
(/
t_1
(fma
(/ (/ t_2 (exp (pow cosTheta 2.0))) (sqrt PI))
t_0
(+ (* (pow c 3.0) cosTheta) cosTheta)))
(pow
(fma
(/ t_2 (* (sqrt PI) cosTheta))
(exp (- (pow cosTheta 2.0)))
(- c -1.0))
-1.0))))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 = fma(c, c, (1.0 - c));
double t_1 = t_0 * cosTheta;
double t_2 = sqrt((1.0 - (cosTheta * 2.0)));
double tmp;
if (t_1 != 0.0) {
tmp = t_1 / fma(((t_2 / exp(pow(cosTheta, 2.0))) / sqrt(((double) M_PI))), t_0, ((pow(c, 3.0) * cosTheta) + cosTheta));
} else {
tmp = pow(fma((t_2 / (sqrt(((double) M_PI)) * cosTheta)), exp(-pow(cosTheta, 2.0)), (c - -1.0)), -1.0);
}
return tmp;
}
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 = fma(c, c, Float64(1.0 - c))
t_1 = Float64(t_0 * cosTheta)
t_2 = sqrt(Float64(1.0 - Float64(cosTheta * 2.0)))
tmp = 0.0
if (t_1 != 0.0)
tmp = Float64(t_1 / fma(Float64(Float64(t_2 / exp((cosTheta ^ 2.0))) / sqrt(pi)), t_0, Float64(Float64((c ^ 3.0) * cosTheta) + cosTheta)));
else
tmp = fma(Float64(t_2 / Float64(sqrt(pi) * cosTheta)), exp(Float64(-(cosTheta ^ 2.0))), Float64(c - -1.0)) ^ -1.0;
end
return tmp
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[(c * c + N[(1.0 - c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * cosTheta), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 - N[(cosTheta * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Unequal[t$95$1, 0.0], N[(t$95$1 / N[(N[(N[(t$95$2 / N[Exp[N[Power[cosTheta, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(N[(N[Power[c, 3.0], $MachinePrecision] * cosTheta), $MachinePrecision] + cosTheta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(t$95$2 / N[(N[Sqrt[Pi], $MachinePrecision] * cosTheta), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[Power[cosTheta, 2.0], $MachinePrecision])], $MachinePrecision] + N[(c - -1.0), $MachinePrecision]), $MachinePrecision], -1.0], $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 := \mathsf{fma}\left(c, c, 1 - c\right)\\
t_1 := t_0 \cdot cosTheta\\
t_2 := \sqrt{1 - cosTheta \cdot 2}\\
\mathbf{if}\;t_1 \ne 0:\\
\;\;\;\;\frac{t_1}{\mathsf{fma}\left(\frac{\frac{t_2}{e^{{cosTheta}^{2}}}}{\sqrt{\pi}}, t_0, {c}^{3} \cdot cosTheta + cosTheta\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{fma}\left(\frac{t_2}{\sqrt{\pi} \cdot cosTheta}, e^{-{cosTheta}^{2}}, c - -1\right)\right)}^{-1}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.2 |
|---|
| Cost | 52612 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{1 - cosTheta \cdot 2}\\
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{t_0}{\sqrt{\pi} \cdot cosTheta}\\
\end{array} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.3 |
|---|
| Cost | 26816 |
|---|
\[\frac{1}{\left(1 + c\right) + \frac{\frac{\sqrt{1 - cosTheta \cdot 2}}{\sqrt{\pi}}}{cosTheta} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\]
| Alternative 3 |
|---|
| Error | 0.8 |
|---|
| Cost | 20672 |
|---|
\[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \left(\left(-0.5 \cdot cosTheta + \frac{1}{cosTheta}\right) - 1\right)\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\]
| Alternative 4 |
|---|
| Error | 0.9 |
|---|
| Cost | 20544 |
|---|
\[\frac{1}{\left(1 + c\right) + \frac{\left(-0.5 \cdot cosTheta + \frac{1}{cosTheta}\right) - 1}{\sqrt{\pi}} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\]
| Alternative 5 |
|---|
| Error | 1.0 |
|---|
| Cost | 20416 |
|---|
\[\frac{1}{\left(1 + c\right) + \left(\frac{1}{\sqrt{\pi}} \cdot \left(\frac{1}{cosTheta} - 1\right)\right) \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\]
| Alternative 6 |
|---|
| Error | 1.1 |
|---|
| Cost | 20288 |
|---|
\[\frac{1}{\left(1 + c\right) + \frac{\frac{1}{cosTheta} - 1}{\sqrt{\pi}} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\]
| Alternative 7 |
|---|
| Error | 1.5 |
|---|
| Cost | 20160 |
|---|
\[\frac{1}{\left(1 + c\right) + \frac{\frac{1}{\sqrt{\pi}}}{cosTheta} \cdot e^{\left(-cosTheta\right) \cdot cosTheta}}
\]
| Alternative 8 |
|---|
| Error | 1.7 |
|---|
| Cost | 12928 |
|---|
\[\sqrt{\pi} \cdot cosTheta
\]
| Alternative 9 |
|---|
| Error | 60.6 |
|---|
| Cost | 64 |
|---|
\[1
\]