• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

PHP atan2 function – Arc tangent of two variables

by admin

Description

This function returns the value of the arctangent of the point denoted by the x and y parameters. The return value is in radians, in the range -pi to pi (approximately -3.14 to 3.14). It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.

Syntax:

atan2(float $y, float $x): float

Parameters

Parameter Description
y Dividend parameter
x Divisor parameter

Return Values

The arc tangent of y/x in radians.

Examples

Example 1:
Calculate the arctangent of a coordinate:

$tanx = -1; 
$tany = 1; 
echo "The arctangent of $tanx/$tany is ", atan2($tanx, $tany)

Filed Under: PHP

Some more articles you might also be interested in …

  1. PHP function convert_cyr_string() – Convert from one Cyrillic character set to another
  2. PHP function str_repeat() – Repeat a string
  3. PHP atan function – Arc tangent
  4. PHP atanh function – Inverse hyperbolic tangent
  5. PHP asin function – Arc sine
  6. PHP function str_replace() – Replace all occurrences of the search string with the replacement string
  7. PHP function abs – Absolute value
  8. How to test a PHP script
  9. PHP connection_status function – Returns connection status bitfield
  10. PHP base_convert function – Convert a number between arbitrary bases

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright