Arduino Forum
>
Topics
>
Education and Teaching
>
Sin() and other math calculacion
Print
Go Down
Pages:
[1]
Topic: Sin() and other math calculacion
(Read 11014 times)
previous topic

next topic
mrax
Newbie
Posts: 8
Karma: 2
[add]
Sin() and other math calculacion
Sep 27, 2015, 09:36 pm
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
Newbie
Posts: 8
Karma: 2
[add]
Re: Sin() and other math calculacion
#1
Sep 27, 2015, 10:14 pm
I find solutioin.
sin(radians (40))*85
econjack
Faraday Member
Posts: 4,420
Karma: 539
[add]
I'm not bossy...I just know what you should be doing.
hamradiodesigns.com
Re: Sin() and other math calculacion
#2
Sep 29, 2015, 02:13 am
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
Newbie
Posts: 4
Karma: 1
[add]
Re: Sin() and other math calculacion
#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
Newbie
Posts: 7
Karma: 3
[add]
machinedock is the leading manufacturer and supplier of all kinds of metal working machinery for cutting, sharpening, reshaping etc.
Re: Sin() and other math calculacion
#4
Nov 30, 2016, 09:10 am
thank you Mrax it is beneficial for me also.
Print
Go Up
Pages:
[1]
Loading...