I have this equation its output using a sci calc is : 0.017… but when i run it in c its output is :0.84..
The input is 1
Equation is: sin(x) – x^4 + 1
float sinp(float p1)
{
float fop;
float ppowers;
printf("%f",p1);
ppowers = pow(p1,4);
fop = sin(p1)-ppowers+1;
return (fop);
}
is there a reason behind this like would it be because of rad or in degree?
I havent really used the sin or any math function of C that much so I don’t really get whats wrong here. Google gave me .84 as an aswer but my calc gives me .017 which is really confusing since I need to get the same output with my calc.
Thank you all 🙂
I am guessing google uses degrees as angle measure in sin, while c++ uses radians and that is the reason for the difference. To convert an angle in degrees to same value in radians to the following:
Where
PIit the good old constant you know.