\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
\log \left(e^{0.5} \cdot e^{\sqrt{\left(-2 \cdot \log u1\right) \cdot 0.027777777777777776} \cdot \cos \left(\left(2 \cdot \pi\right) \cdot u2\right)}\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
(log
(*
(exp 0.5)
(exp
(*
(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 log(exp(0.5) * exp(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.4
Simplified0.4
rmApplied sqrt-unprod_binary640.3
Applied sqrt-unprod_binary640.3
Simplified0.2
rmApplied add-log-exp_binary640.2
Applied add-log-exp_binary640.2
Applied sum-log_binary640.2
Final simplification0.2
herbie shell --seed 2021204
(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))