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

Error

Bits error versus u1

Bits error versus u2

Try it out

  1. Inputs

  2. Original Output:

    Herbie Output:

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. Using strategy rm
  4. Applied add-exp-log0.4

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

Runtime

Time bar (total: 45.1s)Debug logProfile

herbie shell --seed '#(1072361757 3390613284 2339397988 1175251238 145061547 3101881848)' +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))