Average Error: 0.4 → 0.3
Time: 28.2s
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\]
\[\left(\sqrt{\frac{1}{6}} \cdot \left(\sqrt{\frac{1}{6}} \cdot {\left(-2 \cdot \log u1\right)}^{0.5}\right)\right) \cdot \cos \left(\left(2 \cdot \pi\right) \cdot u2\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. Using strategy rm
  3. Applied add-sqr-sqrt0.4

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

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

Runtime

Time bar (total: 28.2s)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' +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))