Average Error: 0.4 → 0.3
Time: 43.2s
Precision: 64
Internal Precision: 384
\[\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\]
\[(\left(\frac{1}{6} \cdot \cos \left(\left(2 \cdot u2\right) \cdot \pi\right)\right) \cdot \left({\left({\left(-\log u1\right)}^{1.0}\right)}^{0.5} \cdot {\left({2}^{1.0}\right)}^{0.5}\right) + 0.5)_*\]

Error

Bits error versus u1

Bits error versus u2

Derivation

  1. Initial program 0.4

    \[\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\]
  2. Applied simplify0.3

    \[\leadsto \color{blue}{(\left(\cos \left(\left(\pi \cdot u2\right) \cdot 2\right)\right) \cdot \left(\frac{{\left(-2 \cdot \log u1\right)}^{0.5}}{6}\right) + 0.5)_*}\]
  3. Taylor expanded around inf 0.4

    \[\leadsto (\left(\cos \left(\left(\pi \cdot u2\right) \cdot 2\right)\right) \cdot \color{blue}{\left(\frac{1}{6} \cdot {\left({2}^{1.0} \cdot {\left(\log \left(\frac{1}{u1}\right)\right)}^{1.0}\right)}^{0.5}\right)} + 0.5)_*\]
  4. Applied simplify0.4

    \[\leadsto \color{blue}{(\left(\frac{1}{6} \cdot \cos \left(\left(2 \cdot u2\right) \cdot \pi\right)\right) \cdot \left({\left({\left(-\log u1\right)}^{1.0} \cdot {2}^{1.0}\right)}^{0.5}\right) + 0.5)_*}\]
  5. Using strategy rm
  6. Applied unpow-prod-down0.3

    \[\leadsto (\left(\frac{1}{6} \cdot \cos \left(\left(2 \cdot u2\right) \cdot \pi\right)\right) \cdot \color{blue}{\left({\left({\left(-\log u1\right)}^{1.0}\right)}^{0.5} \cdot {\left({2}^{1.0}\right)}^{0.5}\right)} + 0.5)_*\]

Runtime

Time bar (total: 43.2s)Debug logProfile

herbie shell --seed '#(1070706311 3771791028 4128836681 4194990999 2341756049 504035650)' +o rules:numerics
(FPCore (u1 u2)
  :name "normal distribution"
  :pre (and (<= 0 u1 1) (<= 0 u2 1))
  (+ (* (* (/ 1 6) (pow (* -2 (log u1)) 0.5)) (cos (* (* 2 PI) u2))) 0.5))