You have to be careful with radians and degrees, don't get them mixed up!
// result is supposed to be -21.6685752754108925 ?
// my casio calculator and the computer says -21.51209184
#include <stdio.h>
#include <math.h>
int main(void)
{
double math, PI, x;
PI = atan(1) * 4.0; // a little old fashioned trickery to get PI
x = 292.797 * PI/180; // degrees to radians
math = asin(sin(x) * 0.39777);
printf("The result is %f radians",math);
math = math * 180 / PI; // radians back to degrees
printf("\nThe result is %f degrees",math);
getchar();
return 0;
}
You may have slipped on one of them darn numbers on those tiny calculator keys, hombre! Close enough! Remember, computers never make missteaks!
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
Offline 5,792 posts
since Oct 2004