Very often you want to find the sine AND cosine of an angle. It is used all the time in computer graphics for all kinds of rotations.

The most obvious way to do it is something like this:

`float sin_angle = sin(angle);`

float cos_angle = cos(angle);

But trigonometric functions are not that fast, and here we are using two of them. However, if you are working with a system capable of vector processing, such as GLSL shaders, then you can find both sine and cosine in a single function call:

`#define HALFPI 1.57079633`

vec2 sin_cos_angle = sin(vec2(angle,HALPI-angle));

It’s quite obvious in hindsight but I have to admit I just never thought of that. I recently saw it on some code on ShaderToy but I can’t remember where. I’d like to give credit so I will continue to search for the person whose code I saw.

I’ve learned a number of cool techniques on Shadertoy. It’s a good place to pick up some pearls. In my experience I’ve also seen that many sin functions also produce cos but maybe throw it away. Here’s a blast from the past. A Cordic SinCos() routine. http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Website/articles/CUJ/1992/9211/bertrand/list1.htm