\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.50.5 + \cos \left(\left(2 \cdot \pi\right) \cdot u2\right) \cdot \frac{\sqrt{-2 \cdot \log u1}}{6}(FPCore (u1 u2) :precision binary64 (+ (* (* (/ 1.0 6.0) (pow (* -2.0 (log u1)) 0.5)) (cos (* (* 2.0 PI) u2))) 0.5))
(FPCore (u1 u2) :precision binary64 (+ 0.5 (* (cos (* (* 2.0 PI) u2)) (/ (sqrt (* -2.0 (log u1))) 6.0))))
double code(double u1, double u2) {
return (((1.0 / 6.0) * pow((-2.0 * log(u1)), 0.5)) * cos((2.0 * ((double) M_PI)) * u2)) + 0.5;
}
double code(double u1, double u2) {
return 0.5 + (cos((2.0 * ((double) M_PI)) * u2) * (sqrt(-2.0 * log(u1)) / 6.0));
}





Bits error versus u1





Bits error versus u2
Results
| Alternative 1 | |
|---|---|
| Error | 1.2 |
| Cost | 13248 |
| Alternative 2 | |
|---|---|
| Error | 52.9 |
| Cost | 64 |


Initial program 0.4
rmApplied associate-*l/_binary640.3
Simplified0.3
rmApplied *-un-lft-identity_binary640.3
Applied *-un-lft-identity_binary640.3
Applied times-frac_binary640.3
Simplified0.3
rmApplied +-commutative_binary640.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2021040
(FPCore (u1 u2)
:name "normal distribution"
:precision binary64
:pre (and (<= 0.0 u1 1.0) (<= 0.0 u2 1.0))
(+ (* (* (/ 1.0 6.0) (pow (* -2.0 (log u1)) 0.5)) (cos (* (* 2.0 PI) u2))) 0.5))