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

Error

Bits error versus u1

Bits error versus u2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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. Using strategy rm
  3. Applied add-log-exp0.4

    \[\leadsto \color{blue}{\log \left(e^{\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}\right)}\]
  4. Applied simplify0.3

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

Runtime

Time bar (total: 58.0s)Debug logProfile

herbie shell --seed 2018206 
(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))