\[\left(\left(cosTheta_i > 0.9999 \land cosTheta_i \leq 1\right) \land \left(2.328306437 \cdot 10^{-10} \leq u1 \land u1 \leq 1\right)\right) \land \left(2.328306437 \cdot 10^{-10} \leq u2 \land u2 \leq 1\right)\]
\[\sqrt{\frac{u1}{1 - u1}} \cdot \cos \left(6.28318530718 \cdot u2\right)
\]
↓
\[\sqrt{\frac{u1}{1 - u1}} \cdot \cos \left({39.47841760436263}^{0.5} \cdot u2\right)
\]
(FPCore (cosTheta_i u1 u2)
:precision binary32
(* (sqrt (/ u1 (- 1.0 u1))) (cos (* 6.28318530718 u2))))
↓
(FPCore (cosTheta_i u1 u2)
:precision binary32
(* (sqrt (/ u1 (- 1.0 u1))) (cos (* (pow 39.47841760436263 0.5) u2))))
float code(float cosTheta_i, float u1, float u2) {
return sqrtf((u1 / (1.0f - u1))) * cosf((6.28318530718f * u2));
}
↓
float code(float cosTheta_i, float u1, float u2) {
return sqrtf((u1 / (1.0f - u1))) * cosf((powf(39.47841760436263f, 0.5f) * u2));
}
real(4) function code(costheta_i, u1, u2)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: u1
real(4), intent (in) :: u2
code = sqrt((u1 / (1.0e0 - u1))) * cos((6.28318530718e0 * u2))
end function
↓
real(4) function code(costheta_i, u1, u2)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: u1
real(4), intent (in) :: u2
code = sqrt((u1 / (1.0e0 - u1))) * cos(((39.47841760436263e0 ** 0.5e0) * u2))
end function
function code(cosTheta_i, u1, u2)
return Float32(sqrt(Float32(u1 / Float32(Float32(1.0) - u1))) * cos(Float32(Float32(6.28318530718) * u2)))
end
↓
function code(cosTheta_i, u1, u2)
return Float32(sqrt(Float32(u1 / Float32(Float32(1.0) - u1))) * cos(Float32((Float32(39.47841760436263) ^ Float32(0.5)) * u2)))
end
function tmp = code(cosTheta_i, u1, u2)
tmp = sqrt((u1 / (single(1.0) - u1))) * cos((single(6.28318530718) * u2));
end
↓
function tmp = code(cosTheta_i, u1, u2)
tmp = sqrt((u1 / (single(1.0) - u1))) * cos(((single(39.47841760436263) ^ single(0.5)) * u2));
end
\sqrt{\frac{u1}{1 - u1}} \cdot \cos \left(6.28318530718 \cdot u2\right)
↓
\sqrt{\frac{u1}{1 - u1}} \cdot \cos \left({39.47841760436263}^{0.5} \cdot u2\right)
Alternatives
| Alternative 1 |
|---|
| Error | 1.9 |
|---|
| Cost | 10020 |
|---|
\[\begin{array}{l}
t_0 := \cos \left(u2 \cdot 6.28318530718\right)\\
\mathbf{if}\;t_0 \leq 0.9973999857902527:\\
\;\;\;\;\sqrt{u1} \cdot \left(1 + \left(t_0 + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{u1}{1 - u1}} \cdot \left(1 + u2 \cdot \left(u2 \cdot -19.739208802181317\right)\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 1.9 |
|---|
| Cost | 6692 |
|---|
\[\begin{array}{l}
\mathbf{if}\;u2 \cdot 6.28318530718 \leq 0.07199999690055847:\\
\;\;\;\;\sqrt{\frac{u1}{1 - u1}} \cdot \left(1 + u2 \cdot \left(u2 \cdot -19.739208802181317\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(u2 \cdot 6.28318530718\right) \cdot \sqrt{u1}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.4 |
|---|
| Cost | 6688 |
|---|
\[\frac{\cos \left(u2 \cdot 6.28318530718\right)}{\sqrt{\frac{1}{u1} + -1}}
\]
| Alternative 4 |
|---|
| Error | 0.3 |
|---|
| Cost | 6688 |
|---|
\[\sqrt{\frac{u1}{1 - u1}} \cdot \cos \left(u2 \cdot 6.28318530718\right)
\]
| Alternative 5 |
|---|
| Error | 3.7 |
|---|
| Cost | 3616 |
|---|
\[\sqrt{\frac{u1}{1 - u1}} \cdot \left(1 + u2 \cdot \left(u2 \cdot -19.739208802181317\right)\right)
\]
| Alternative 6 |
|---|
| Error | 6.3 |
|---|
| Cost | 3360 |
|---|
\[\sqrt{\frac{u1}{1 - u1}}
\]
| Alternative 7 |
|---|
| Error | 11.7 |
|---|
| Cost | 3232 |
|---|
\[\sqrt{u1}
\]
| Alternative 8 |
|---|
| Error | 25.5 |
|---|
| Cost | 96 |
|---|
\[u1 + 0.5
\]
| Alternative 9 |
|---|
| Error | 25.9 |
|---|
| Cost | 32 |
|---|
\[u1
\]