Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401]

(no description)

File Size: 161 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Tangent:: (5 methods):
  tan()
  tanh()
  atan()
  atanh()
  atan2()


Class: Tangent  - X-Ref

tan($angle)   X-Ref
TAN.

Returns the result of builtin function tan after validating args.

param: mixed $angle Should be numeric, or can be an array of numbers
return: array|float|string tangent

tanh($angle)   X-Ref
TANH.

Returns the result of builtin function sinh after validating args.

param: mixed $angle Should be numeric, or can be an array of numbers
return: array|float|string hyperbolic tangent

atan($number)   X-Ref
ATAN.

Returns the arctangent of a number.

param: array|float $number Number, or can be an array of numbers
return: array|float|string The arctangent of the number

atanh($number)   X-Ref
ATANH.

Returns the inverse hyperbolic tangent of a number.

param: array|float $number Number, or can be an array of numbers
return: array|float|string The inverse hyperbolic tangent of the number

atan2($xCoordinate, $yCoordinate)   X-Ref
ATAN2.

This function calculates the arc tangent of the two variables x and y. 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.
The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
-pi and pi, excluding -pi.

Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard
PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.

Excel Function:
ATAN2(xCoordinate,yCoordinate)

param: mixed $xCoordinate should be float, the x-coordinate of the point, or can be an array of numbers
param: mixed $yCoordinate should be float, the y-coordinate of the point, or can be an array of numbers
return: array|float|string