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 / Cosine.php

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

117 lines 3.1 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 Cosine
10 {
11 use ArrayEnabled;
12
13 /**
14 * COS.
15 *
16 * Returns the result of builtin function cos after validating args.
17 *
18 * @param mixed $number Should be numeric, or can be an array of numbers
19 *
20 * @return array<mixed>|float|string cosine
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 cos($number)
25 {
26 if (is_array($number)) {
27 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number);
28 }
29
30 try {
31 $number = Helpers::validateNumericNullBool($number);
32 } catch (Exception $e) {
33 return $e->getMessage();
34 }
35
36 return cos($number);
37 }
38
39 /**
40 * COSH.
41 *
42 * Returns the result of builtin function cosh after validating args.
43 *
44 * @param mixed $number Should be numeric, or can be an array of numbers
45 *
46 * @return array<mixed>|float|string hyperbolic cosine
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 cosh($number)
51 {
52 if (is_array($number)) {
53 return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number);
54 }
55
56 try {
57 $number = Helpers::validateNumericNullBool($number);
58 } catch (Exception $e) {
59 return $e->getMessage();
60 }
61
62 return cosh($number);
63 }
64
65 /**
66 * ACOS.
67 *
68 * Returns the arccosine 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 arccosine 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 acos($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 Helpers::numberOrNan(acos($number));
89 }
90
91 /**
92 * ACOSH.
93 *
94 * Returns the arc inverse hyperbolic cosine 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 inverse hyperbolic cosine of the number, or an error string
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 acosh($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 return Helpers::numberOrNan(acosh($number));
115 }
116 }
117