Average Error: 0.4 → 0.3
Time: 44.0s
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\]
\[0.5 + \cos \left(\left(\pi \cdot u2\right) \cdot 2\right) \cdot \frac{{\left(-2 \cdot \log u1\right)}^{0.5}}{6}\]

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. Using strategy rm
  4. Applied div-inv0.4

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

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

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

Runtime

Time bar (total: 44.0s)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' 
(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))