acos()


float acos ( float $arg )

Description

acos() returns the arc cosine of $arg in radians. acos() is the complementary function of the cos().

※ available F/W version : all

Parameters

Return values

Returns the arc cosine of $arg in radians

Example

<?php
$rad = 1.0;

$val1 = cos($rad);
$val2 = acos($val1);

echo "cos($rad) = $val1\r\n";  // OUTPUT: cos(1) = 0.54030230586814
echo "acos($val1) = $val2\r\n";  // OUTPUT: acos(0.54030230586814) = 1
?>
<?php
// 1.1 is invalid argument for the acos() so it returns NAN (Not A Number)
$val = acos(1.1);
echo "acos(1.1) = $val\r\n";  // OUTPUT: acos(1.1) = NAN
?>

See also

cos()

Remarks

This function is identical to the PHP group’s acos() function.