Diffrence between sinx() and __sin(x)


I want to know what is the difference between sin(x) and __sin(x). I read that sin(x) is slower. Why it is so, and why should one use slower instructions when the fasters are available?


I don’t remember the specifics but i understand you trade speed for precision. The __sin is supposed to be much faster than any CPU equivelant.

Check the programming guide, it specifies the differences. __sin() is only valid with a certain number of ulp errors for x in a given range (see the guide). Whereas sin(x) is valid over the full range of x.

__Sin(x) is okay to use for most single precision algos… unless your application does some iterative refinement or root solving kind of stuff … because then the error tends to build up rapidly… I was witness to this in my own code.

Thanks Nitin!, I got the point.