Implementation error
3 Jun 09, 2:41PM
Implementation error
I think the sign for this function may be inverted. Compare the graph with the wiki page: http://en.wikipedia.org/wiki/Fresnel_integral
In the code, the sign variable is being calculated incorrectly. Replacing
int sign = 2*(x<0) - 1;
with something like
const int sign = x > 0 ? +1 : -1;
should fix it.
The same thing applies to the cosine equivalent.
Login