Average Error: 0.4 → 0.4
Time: 33.1s
Precision: 64
Ground Truth: 128
\[\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\]
\[\frac{{\left(-2 \cdot \log u1\right)}^{0.5}}{\frac{6}{\cos \left(\left(\pi + \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. Applied simplify 0.4

    \[\leadsto \color{blue}{\frac{{\left(-2 \cdot \log u1\right)}^{0.5} \cdot \cos \left(\left(\pi + \pi\right) \cdot u2\right)}{6} + 0.5}\]
  3. Using strategy rm
  4. Applied associate-/l* 0.4

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

Runtime

Total time: 33.1s Debug log

Please include this information when filing a bug report:

herbie --seed '#(891312904 2300291098 3119340403 4122138140 2976955964 525892566)'
(FPCore (u1 u2)
  :name "normal distribution"
  :herbie-samplers ((u1 (uniform 0 1)) (u2 (uniform 0 1)))
  (+ (* (* (/ 1 6) (pow (* -2 (log u1)) 0.5)) (cos (* (* 2 PI) u2))) 0.5))