PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Calculation / MathTrig / Trig / Cotangent.php

Cotangent.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/MathTrig/Trig/Cotangent.php

119 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
6 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Exception;
7 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers;
8
9 class Cotangent
10 {
11 use ArrayEnabled;
12
13 /**
14 * COT.
15 *
16 * Returns the cotangent of an angle.
17 *
18 * @param array<mixed>|float $angle Number, or can be an array of numbers
19 *
20 * @return array<mixed>|float|string The cotangent of the angle
21 * If an array of numbers is passed as the argument, then the returned result will also be an array
22 * with the same dimensions
23 */
24 public static function cot($angle)
25 {
26 if (is_array($angle)) {
27 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle);
28 }
29
30 try {
31 $angle = Helpers::validateNumericNullBool($angle);
32 } catch (Exception $e) {
33 return $e->getMessage();
34 }
35
36 return Helpers::verySmallDenominator(cos($angle), sin($angle));
37 }
38
39 /**
40 * COTH.
41 *
42 * Returns the hyperbolic cotangent of an angle.
43 *
44 * @param array<mixed>|float $angle Number, or can be an array of numbers
45 *
46 * @return array<mixed>|float|string The hyperbolic cotangent of the angle
47 * If an array of numbers is passed as the argument, then the returned result will also be an array
48 * with the same dimensions
49 */
50 public static function coth($angle)
51 {
52 if (is_array($angle)) {
53 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle);
54 }
55
56 try {
57 $angle = Helpers::validateNumericNullBool($angle);
58 } catch (Exception $e) {
59 return $e->getMessage();
60 }
61
62 return Helpers::verySmallDenominator(1.0, tanh($angle));
63 }
64
65 /**
66 * ACOT.
67 *
68 * Returns the arccotangent of a number.
69 *
70 * @param array<mixed>|float $number Number, or can be an array of numbers
71 *
72 * @return array<mixed>|float|string The arccotangent of the number
73 * If an array of numbers is passed as the argument, then the returned result will also be an array
74 * with the same dimensions
75 */
76 public static function acot($number)
77 {
78 if (is_array($number)) {
79 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number);
80 }
81
82 try {
83 $number = Helpers::validateNumericNullBool($number);
84 } catch (Exception $e) {
85 return $e->getMessage();
86 }
87
88 return (M_PI / 2) - atan($number);
89 }
90
91 /**
92 * ACOTH.
93 *
94 * Returns the hyperbolic arccotangent of a number.
95 *
96 * @param array<mixed>|float $number Number, or can be an array of numbers
97 *
98 * @return array<mixed>|float|string The hyperbolic arccotangent of the number
99 * If an array of numbers is passed as the argument, then the returned result will also be an array
100 * with the same dimensions
101 */
102 public static function acoth($number)
103 {
104 if (is_array($number)) {
105 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number);
106 }
107
108 try {
109 $number = Helpers::validateNumericNullBool($number);
110 } catch (Exception $e) {
111 return $e->getMessage();
112 }
113
114 $result = ($number === 1) ? NAN : (log(($number + 1) / ($number - 1)) / 2);
115
116 return Helpers::numberOrNan($result);
117 }
118 }
119