Trigonometric functions: Difference between revisions
Content added Content deleted
(omit m4) |
Underscore (talk | contribs) (→{{header|Perl}}: Changed to use print variadically instead of building up the input through concatenation. Added "my"s.) |
||
Line 665: | Line 665: | ||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
{{works with|Perl|5.8.8}} |
{{works with|Perl|5.8.8}} |
||
⚫ | |||
use Math::Trig; |
|||
⚫ | |||
$angle_degrees = 45; |
|||
$angle_radians = pi / 4; |
|||
my $angle_degrees = 45; |
|||
my $angle_radians = pi / 4; |
|||
⚫ | |||
print |
print sin($angle_radians), ' ', sin(deg2rad($angle_degrees)), "\n"; |
||
⚫ | |||
⚫ | |||
print $ |
print tan($angle_radians), ' ', tan(deg2rad($angle_degrees)), "\n"; |
||
print cot($angle_radians), ' ', cot(deg2rad($angle_degrees)), "\n"; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
print $asin, ' ', rad2deg($asin), "\n"; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
</lang> |
|||
⚫ | |||
⚫ | |||
Output: |
Output: |