Cheryl F. answered 05/04/19
Scientific Programming is Science aided by Software
So the trigonometric functions, when you need them, are compiled into a program when you use the -lm flag on the compiler, for example,
gcc triggered triggered.c -lm
where triggered.c is:
#include <math.h>
#include <stdio.h>
#define PI 3.14159
int main ()
{
printf ("sine of PI/7 is %f\n", sin((double) (PI/7.0)));
}
you can run
./triggered
to produce:
sine of PI/7 is 0.433883
But where is the source for the math library you link in statically with -lm?
It is in glibc. The source for glibc lives in the gnu git repository (today) which you can obtain with
git clone git://sourceware.org/git/glibc.git
you might want to go to glibc/ieee754/dbl-64/dosincos.c
to see a fairly straightforward implementation of the sine function as you're likely to experience it when you actually do the calculation. It's only about a hundred LOC, and worthy of study.