Difficulty using trignometric functions in iPhone app
in a开发者_C百科n iphone application i want to use the trignometic functions. but the answer is not coming correctly. this is my code:
#include"math.h"
double tri;
tri=sin(90);
printf("%lf",tri);
for this the answer is coming as 0.893977 how can i correct the code to get the answer as 1
double tri;
tri=sin(90.0 * 3.1415926/180.0);
printf("%lf",tri);
The arguments to standard trigonometric functions should be supplied in radians, not degrees.
精彩评论