Average Error: 0.4 → 0.5
Time: 44.4s
Precision: 64
Internal precision: 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(\frac{{\left(\log u1 \cdot -2\right)}^{0.5}}{\frac{6}{\cos \left(u2 \cdot \left(\pi + \pi\right)\right)}}\right)}^3 + {0.5}^3}{{\left(\frac{{\left(-2 \cdot \log u1\right)}^{0.5} \cdot \cos \left(\left(\pi + \pi\right) \cdot u2\right)}{6}\right)}^2 + \left({0.5}^2 - \frac{{\left(-2 \cdot \log u1\right)}^{0.5} \cdot \cos \left(\left(\pi + \pi\right) \cdot u2\right)}{6} \cdot 0.5\right)}\]

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.3

    \[\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 flip3-+ 0.5

    \[\leadsto \color{blue}{\frac{{\left(\frac{{\left(-2 \cdot \log u1\right)}^{0.5} \cdot \cos \left(\left(\pi + \pi\right) \cdot u2\right)}{6}\right)}^{3} + {0.5}^{3}}{{\left(\frac{{\left(-2 \cdot \log u1\right)}^{0.5} \cdot \cos \left(\left(\pi + \pi\right) \cdot u2\right)}{6}\right)}^2 + \left({0.5}^2 - \frac{{\left(-2 \cdot \log u1\right)}^{0.5} \cdot \cos \left(\left(\pi + \pi\right) \cdot u2\right)}{6} \cdot 0.5\right)}}\]
  5. Applied simplify 0.5

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

Runtime

Time bar (total: 44.4s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(764137492 2325562199 1225308435 1835239525 669944063 1038246356)'
(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))