Perl atan2 Function


Advertisements


Description

This function returns the arctangent of Y/X in the range -PI to PI.

Syntax

Following is the simple syntax for this function −

atan2 Y,X

Return Value

This function returns arctangent of Y/X in the range -PI to PI.

Example

Following is the example code showing its basic usage −

Live Demo
#!/usr/bin/perl

$Y = 30;
$X = 60;

$ret_val = atan2 ($Y, $X );

print "atan2 of 30/60 is : $ret_val\n";

When above code is executed, it produces the following result −

atan2 of 30/60 is : 0.463647609000806

perl_function_references.htm

Advertisements