\[\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \pi\right) \cdot u2\right) + 0.5\]
Test:
normal distribution
Bits:
128 bits
Bits error versus u1
Bits error versus u2
Time: 7.6 s
Input Error: 0.4
Output Error: 0.4
Log:
Profile: 🕒
\((\left(\frac{1}{6} \cdot {\left({-2}^{1.0} \cdot {\left(\log u1\right)}^{1.0}\right)}^{0.5}\right) * \left(\cos \left(\pi \cdot \left(u2 \cdot 2\right)\right)\right) + 0.5)_*\)
  1. Started with
    \[\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \pi\right) \cdot u2\right) + 0.5\]
    0.4
  2. Applied simplify to get
    \[\color{red}{\left(\frac{1}{6} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right) \cdot \cos \left(\left(2 \cdot \pi\right) \cdot u2\right) + 0.5} \leadsto \color{blue}{(\left(\frac{{\left(-2 \cdot \log u1\right)}^{0.5}}{6}\right) * \left(\cos \left(\pi \cdot \left(u2 \cdot 2\right)\right)\right) + 0.5)_*}\]
    0.4
  3. Applied taylor to get
    \[(\left(\frac{{\left(-2 \cdot \log u1\right)}^{0.5}}{6}\right) * \left(\cos \left(\pi \cdot \left(u2 \cdot 2\right)\right)\right) + 0.5)_* \leadsto (\left(\frac{1}{6} \cdot {\left({-2}^{1.0} \cdot {\left(\log u1\right)}^{1.0}\right)}^{0.5}\right) * \left(\cos \left(\pi \cdot \left(u2 \cdot 2\right)\right)\right) + 0.5)_*\]
    0.4
  4. Taylor expanded around 0 to get
    \[(\color{red}{\left(\frac{1}{6} \cdot {\left({-2}^{1.0} \cdot {\left(\log u1\right)}^{1.0}\right)}^{0.5}\right)} * \left(\cos \left(\pi \cdot \left(u2 \cdot 2\right)\right)\right) + 0.5)_* \leadsto (\color{blue}{\left(\frac{1}{6} \cdot {\left({-2}^{1.0} \cdot {\left(\log u1\right)}^{1.0}\right)}^{0.5}\right)} * \left(\cos \left(\pi \cdot \left(u2 \cdot 2\right)\right)\right) + 0.5)_*\]
    0.4

  5. Removed slow pow expressions

Original test:


(lambda ((u1 (uniform 0 1)) (u2 (uniform 0 1)))
  #:name "normal distribution"
  (+ (* (* (/ 1 6) (pow (* -2 (log u1)) 0.5)) (cos (* (* 2 PI) u2))) 0.5))