sin()
Description
Calculates the sine of an angle (in radians). The result will be between -1 and 1.
Syntax
Use the following function to calculate the sine of a given angle in radians:
sin(rad)
Parameters
The function admits the following parameter:
rad
: The angle in radians. Allowed data types: float
.Returns
The function returns the sine of the angle. Data type:
double
.Example Code
1float angle = (2.0 / 3.0) * M_PI; // in radians2double res = 0;3
4void setup() {5 Serial.begin(9600);6
7 res = sin(angle);8
9 Serial.print("The angle sine is: ");10 Serial.println(res);11}12
13void loop() {14}
See also
Suggest changes
The content on docs.arduino.cc is facilitated through a public GitHub repository. If you see anything wrong, you can edit this page here.
License
The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.