acos

(PHP 4, PHP 5, PHP 7, PHP 8)

acosArc cosine

Description

acos(float $num): float

Returns the arc cosine of num in radians. acos() is the inverse function of cos(), which means that $num == cos(acos($num)) for every value of num that is in the domain of acos().

Parameters

num

The argument to process

Return Values

The arc cosine of num in radians.

See Also

add a note

User Contributed Notes 1 note

up
0
isweet479338 at gmail dot com
1 month ago
Parameter:
$num: A float value between -1 and 1. (Outside this range will return NAN)

Returns:
The arc cosine of the number in radians.

NAN (Not A Number) if the input is outside [-1, 1].

<?php
$cosValue
= 0.5;
$angle = acos($cosValue); / returns angle in radians
echo $angle; / 1.0471975512 (which is ~60 degrees)

echo rad2deg($angle); / Convert to degrees: ~60
?>
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant