sincos.3: Note that sincos() is intended to be more efficient than sin() + cos()
On a current x86-64 i7 system, sincos() is about 15% faster than
sin()+cos() according to the following test program.
/*
* Build with: cc -O -lm -fno-fast-math -fno-builtin
*/
int
main(int argc, char *argv[])
{
double arg, rsin, rcos;
int loop, i;
arg = strtod(argv[1], NULL);
loop =
10000000;
if (argc > 2)
loop = atoi(argv[2]);
if (argc > 3) {
printf("sin + cos\n");
for (i = 0; i < loop; i++) {
rsin = sin(arg);
rcos = cos(arg);
}
} else {
printf("sincos\n");
for (i = 0; i < loop; i++) {
sincos(arg, &rsin, &rcos);
}
}
}
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>