Go Down

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



I have problem with matematic.

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

I need result like desktop calculator. How


I find solutioin.

sin(radians (40))*85


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.


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.


thank you Mrax it is beneficial for me also.

Go Up