Go Down

Topic: Sin() and other math calculacion (Read 11014 times) previous topic - next topic

mrax

Hi,

I have problem with matematic.

when i calculate (with desktop calculator) sin(40)*85 result is 54,63
but
when i put this formula in arduino result is 63,33

I need result like desktop calculator. How

mrax

I find solutioin.

sin(radians (40))*85



econjack

Also, the math function usually require floating point numbers, so it's best to write the statement as:

  x = sin(radians (40.0))*85.0;

The use of the decimal point makes it clear that floating point calculations are required.

akbarkhan

#3
Sep 21, 2016, 05:04 pm Last Edit: Sep 21, 2016, 05:10 pm by akbarkhan
Here is the prototype of sin function of math.h library.
double sin(double x);
x : A floating point value representing an angle in radians.
If you have angle in degree then you can convert it to radian by multiplying it with (3.14/180). Hope it helps.

daljitgroup

thank you Mrax it is beneficial for me also.

Go Up