Average Error: 0.4 → 0.4
Time: 2.3m
Precision: 64
Internal Precision: 576
\[\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\]
\[\frac{\cos \left(\left(u2 \cdot 2\right) \cdot \pi\right)}{\frac{6}{{\left(\log u1 \cdot -2\right)}^{0.5}}} + 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.4

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

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

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

Runtime

Time bar (total: 2.3m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' 
(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))