Perl Programming/Keywords/sin

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: shutdown Keywords Next: sleep

The sin keyword[edit | edit source]

sin is the trigonometric function sine that assumes that X is in radians.

Syntax[edit | edit source]

  sin(X)

Examples[edit | edit source]

The code
*PI = \3.1415926535;
$a = 30;	# in degrees
$sin = sin($a/180*$PI);

print "sin(" . $a . "°) = " . $sin . "\n";
prints the sine of the angle of 30 degrees:


Previous: shutdown Keywords Next: sleep