\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 + \sqrt{\left(-2 \cdot \log u1\right) \cdot 0.027777777777777776} \cdot \cos \left(\left(2 \cdot \pi\right) \cdot u2\right)(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 (* (sqrt (* (* -2.0 (log u1)) 0.027777777777777776)) (cos (* (* 2.0 PI) u2)))))
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 + (sqrt((-2.0 * log(u1)) * 0.027777777777777776) * cos((2.0 * ((double) M_PI)) * u2));
}



Bits error versus u1



Bits error versus u2
Results
Initial program 0.4
Simplified0.4
rmApplied add-sqr-sqrt_binary640.4
Applied associate-*l*_binary640.3
Simplified0.3
rmApplied sqrt-unprod_binary640.3
Applied sqrt-unprod_binary640.3
Simplified0.2
Final simplification0.2
herbie shell --seed 2020233
(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))