cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

jmyc
Journeyman III

problem with erfc function

Numerical accuracy of erfc function seems problematic

I am running some kind of Monte Carlo on GPU using opencl. I've got some strange results so I started to investigate problem. Seems that values of erfc function are wrong for some arguments.

Example: attached kernel run on  CPU gives the correct result:  0.330402, but for GPU it gives a completely wrong answer: 0.0804025.

My system: Linux, kernel 2.6.28-16, gcc 4.3.3. CPU AMD64, quad core. GPU: ATI HD4770.

float phi(float z) { /* Standard statistical normal distribution*/ return erfc( -z/sqrt(2) )/2; } /*Simulates normal probabilities using quasi Monte Carlo*/ __kernel void qsimKernel(__global float * prob) { prob[0]=phi(-0.438802f); }

0 Likes
2 Replies
genaganna
Journeyman III

Jmyc,

       Thank you for reporting this issue.

0 Likes

Jmyc,

       Please use following workarounds presently if you are blocked by this bug.

 

       Work around One : Divide erfc result by 2

       Work around two : Replace erfc(z) with 1 - erf(z)

0 Likes