Hacker News new | ask | show | jobs
by jacobolus 1361 days ago
You can if you want make a polynomial in turns. The CPU isn’t going to care one way or the other.

Implementations which are accurate in terms of turns even for values close to half a turn can be useful for avoiding numerical issues that sometimes pop up because π is not exactly expressible as a floating point number. These functions usually names like sinpi, cospi, etc. It would be nice if they were provided more often in standard libraries.

1 comments

Based on the article, CUDA has a sinpi instruction (or whatever they call them in CUDA-land). Does anyone know -- is sinpi commonly provided in the CPU assembly extension ecosystem (avx & friends)? Light googling showed me some APIs that had implementations, but I didn't dig in enough to see if they are directly implemented in assembly (this seems like the sort of info a wizard here would know about, and probably whether these types of instructions tend to be well-implemented...).