\[\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)
\]
↓
\[\begin{array}{l}
t_0 := \frac{u1}{1 - u1 \cdot u1}\\
\sqrt{t_0 + u1 \cdot t_0} \cdot \cos \left(6.28318530718 \cdot u2\right)
\end{array}
\]
(FPCore (cosTheta_i u1 u2)
:precision binary32
(* (sqrt (/ u1 (- 1.0 u1))) (cos (* 6.28318530718 u2))))
↓
(FPCore (cosTheta_i u1 u2)
:precision binary32
(let* ((t_0 (/ u1 (- 1.0 (* u1 u1)))))
(* (sqrt (+ t_0 (* u1 t_0))) (cos (* 6.28318530718 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) {
float t_0 = u1 / (1.0f - (u1 * u1));
return sqrtf((t_0 + (u1 * t_0))) * cosf((6.28318530718f * 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
real(4) :: t_0
t_0 = u1 / (1.0e0 - (u1 * u1))
code = sqrt((t_0 + (u1 * t_0))) * cos((6.28318530718e0 * 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)
t_0 = Float32(u1 / Float32(Float32(1.0) - Float32(u1 * u1)))
return Float32(sqrt(Float32(t_0 + Float32(u1 * t_0))) * cos(Float32(Float32(6.28318530718) * 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)
t_0 = u1 / (single(1.0) - (u1 * u1));
tmp = sqrt((t_0 + (u1 * t_0))) * cos((single(6.28318530718) * u2));
end
\sqrt{\frac{u1}{1 - u1}} \cdot \cos \left(6.28318530718 \cdot u2\right)
↓
\begin{array}{l}
t_0 := \frac{u1}{1 - u1 \cdot u1}\\
\sqrt{t_0 + u1 \cdot t_0} \cdot \cos \left(6.28318530718 \cdot u2\right)
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 96.4% |
|---|
| Cost | 6820.00 |
|---|
\[\begin{array}{l}
\mathbf{if}\;6.28318530718 \cdot u2 \leq 0.11999999731779099:\\
\;\;\;\;\sqrt{\frac{u1}{1 - u1}} \cdot \left(1 + -19.739208802181317 \cdot \left(u2 \cdot u2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(6.28318530718 \cdot u2\right) \cdot \sqrt{u1 \cdot \left(u1 + 1\right)}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 94.3% |
|---|
| Cost | 6692.00 |
|---|
\[\begin{array}{l}
\mathbf{if}\;6.28318530718 \cdot u2 \leq 0.2199999988079071:\\
\;\;\;\;\sqrt{\frac{u1}{1 - u1}} \cdot \left(1 + -19.739208802181317 \cdot \left(u2 \cdot u2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(6.28318530718 \cdot u2\right) \cdot \sqrt{u1}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 99.0% |
|---|
| Cost | 6688.00 |
|---|
\[\cos \left(6.28318530718 \cdot u2\right) \cdot \sqrt{\frac{u1}{1 - u1}}
\]
| Alternative 4 |
|---|
| Error | 88.8% |
|---|
| Cost | 3616.00 |
|---|
\[\sqrt{\frac{u1}{1 - u1}} \cdot \left(1 + -19.739208802181317 \cdot \left(u2 \cdot u2\right)\right)
\]
| Alternative 5 |
|---|
| Error | 88.8% |
|---|
| Cost | 3616.00 |
|---|
\[\sqrt{\frac{u1}{1 - u1}} \cdot \left(1 + u2 \cdot \left(u2 \cdot -19.739208802181317\right)\right)
\]
| Alternative 6 |
|---|
| Error | 80.3% |
|---|
| Cost | 3392.00 |
|---|
\[{\left(\frac{u1}{1 - u1}\right)}^{0.5}
\]
| Alternative 7 |
|---|
| Error | 72.2% |
|---|
| Cost | 3360.00 |
|---|
\[\sqrt{u1 \cdot \left(u1 + 1\right)}
\]
| Alternative 8 |
|---|
| Error | 72.2% |
|---|
| Cost | 3360.00 |
|---|
\[\sqrt{u1 + u1 \cdot u1}
\]
| Alternative 9 |
|---|
| Error | 80.3% |
|---|
| Cost | 3360.00 |
|---|
\[\sqrt{\frac{u1}{1 - u1}}
\]
| Alternative 10 |
|---|
| Error | 63.9% |
|---|
| Cost | 3232.00 |
|---|
\[\sqrt{u1}
\]
| Alternative 11 |
|---|
| Error | 20.1% |
|---|
| Cost | 96.00 |
|---|
\[u1 + 0.5
\]
| Alternative 12 |
|---|
| Error | 19.1% |
|---|
| Cost | 32.00 |
|---|
\[u1
\]