Found a 64bit double implementation library, but I cannot compile it

lesto:
work until -15 <= i <= 15..

Yes but these are radians, not degrees. You shouldn't have to work outside the range 0 to 2 * pi. After that it just repeats.

Or even the range 0 to pi/2. You just need to force your numbers into that range and swap the sign if necessary.