ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Tangent.php
Go to the documentation of this file.
1 <?php
2 
4 
8 
9 class Tangent
10 {
20  public static function tan($angle)
21  {
22  try {
24  } catch (Exception $e) {
25  return $e->getMessage();
26  }
27 
28  return Helpers::verySmallDenominator(sin($angle), cos($angle));
29  }
30 
40  public static function tanh($angle)
41  {
42  try {
44  } catch (Exception $e) {
45  return $e->getMessage();
46  }
47 
48  return tanh($angle);
49  }
50 
60  public static function atan($number)
61  {
62  try {
63  $number = Helpers::validateNumericNullBool($number);
64  } catch (Exception $e) {
65  return $e->getMessage();
66  }
67 
68  return Helpers::numberOrNan(atan($number));
69  }
70 
80  public static function atanh($number)
81  {
82  try {
83  $number = Helpers::validateNumericNullBool($number);
84  } catch (Exception $e) {
85  return $e->getMessage();
86  }
87 
88  return Helpers::numberOrNan(atanh($number));
89  }
90 
112  public static function atan2($xCoordinate, $yCoordinate)
113  {
114  try {
115  $xCoordinate = Helpers::validateNumericNullBool($xCoordinate);
116  $yCoordinate = Helpers::validateNumericNullBool($yCoordinate);
117  } catch (Exception $e) {
118  return $e->getMessage();
119  }
120 
121  if (($xCoordinate == 0) && ($yCoordinate == 0)) {
122  return Functions::DIV0();
123  }
124 
125  return atan2($yCoordinate, $xCoordinate);
126  }
127 }
static atan2($xCoordinate, $yCoordinate)
ATAN2.
Definition: Tangent.php:112
static validateNumericNullBool($number)
Many functions accept null/false/true argument treated as 0/0/1.
Definition: Helpers.php:27
static numberOrNan($result)
Return NAN or value depending on argument.
Definition: Helpers.php:125
static verySmallDenominator(float $numerator, float $denominator)
Many functions accept null/false/true argument treated as 0/0/1.
Definition: Helpers.php:15
$angle