Average Error: 0.4 → 0.4
Time: 1.1m
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(u2 \cdot \left(\pi + \pi\right)\right) \cdot \frac{1}{6 \cdot \frac{1}{{\left(-2 \cdot \log u1\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}{0.5 + \cos \left(u2 \cdot \left(\pi + \pi\right)\right) \cdot \frac{{\left(-2 \cdot \log u1\right)}^{0.5}}{6}}\]
  3. Using strategy rm
  4. Applied clear-num0.3

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

    \[\leadsto 0.5 + \cos \left(u2 \cdot \left(\pi + \pi\right)\right) \cdot \frac{1}{\color{blue}{6 \cdot \frac{1}{{\left(-2 \cdot \log u1\right)}^{0.5}}}}\]
  7. Removed slow pow expressions.

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed '#(1063027428 1192549564 1443466578 604016274 3637110559 1698629644)' 
(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))