I'm given a value of cos(x) and I want to find sin(x)
There are two ways I can think of, but which way takes less CPU time..and are there even better ways that save time?
Given:
double cosX = some number;
1)
double sinX = sin(invCos(cosX));
2)
double sinX = sqrt(1 - cosX * cosX);
-------------
i dunno what goes on inside of invCos() and sin() functions (lets assumg C++ here)
or what goes on inside sqrt()...
Or are there even more efficient ways to calculate/optimize this?
There are two ways I can think of, but which way takes less CPU time..and are there even better ways that save time?
Given:
double cosX = some number;
1)
double sinX = sin(invCos(cosX));
2)
double sinX = sqrt(1 - cosX * cosX);
-------------
i dunno what goes on inside of invCos() and sin() functions (lets assumg C++ here)
or what goes on inside sqrt()...
Or are there even more efficient ways to calculate/optimize this?