| 1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace PhpOffice\PhpSpreadsheet\Calculation;
|
|
|
4 |
|
|
|
5 |
/**
|
|
|
6 |
* @deprecated 1.18.0
|
|
|
7 |
*/
|
|
|
8 |
class MathTrig
|
|
|
9 |
{
|
|
|
10 |
/**
|
|
|
11 |
* ARABIC.
|
|
|
12 |
*
|
|
|
13 |
* Converts a Roman numeral to an Arabic numeral.
|
|
|
14 |
*
|
|
|
15 |
* Excel Function:
|
|
|
16 |
* ARABIC(text)
|
|
|
17 |
*
|
|
|
18 |
* @deprecated 1.18.0
|
|
|
19 |
* Use the evaluate method in the MathTrig\Arabic class instead
|
|
|
20 |
* @see MathTrig\Arabic::evaluate()
|
|
|
21 |
*
|
|
|
22 |
* @param array|string $roman
|
|
|
23 |
*
|
|
|
24 |
* @return array|int|string the arabic numberal contrived from the roman numeral
|
|
|
25 |
*/
|
|
|
26 |
public static function ARABIC($roman)
|
|
|
27 |
{
|
|
|
28 |
return MathTrig\Arabic::evaluate($roman);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* ATAN2.
|
|
|
33 |
*
|
|
|
34 |
* This function calculates the arc tangent of the two variables x and y. It is similar to
|
|
|
35 |
* calculating the arc tangent of y ÷ x, except that the signs of both arguments are used
|
|
|
36 |
* to determine the quadrant of the result.
|
|
|
37 |
* The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
|
|
|
38 |
* point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
|
|
|
39 |
* -pi and pi, excluding -pi.
|
|
|
40 |
*
|
|
|
41 |
* Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard
|
|
|
42 |
* PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.
|
|
|
43 |
*
|
|
|
44 |
* Excel Function:
|
|
|
45 |
* ATAN2(xCoordinate,yCoordinate)
|
|
|
46 |
*
|
|
|
47 |
* @deprecated 1.18.0
|
|
|
48 |
* Use the atan2 method in the MathTrig\Trig\Tangent class instead
|
|
|
49 |
* @see MathTrig\Trig\Tangent::atan2()
|
|
|
50 |
*
|
|
|
51 |
* @param array|float $xCoordinate the x-coordinate of the point
|
|
|
52 |
* @param array|float $yCoordinate the y-coordinate of the point
|
|
|
53 |
*
|
|
|
54 |
* @return array|float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error
|
|
|
55 |
*/
|
|
|
56 |
public static function ATAN2($xCoordinate = null, $yCoordinate = null)
|
|
|
57 |
{
|
|
|
58 |
return MathTrig\Trig\Tangent::atan2($xCoordinate, $yCoordinate);
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
/**
|
|
|
62 |
* BASE.
|
|
|
63 |
*
|
|
|
64 |
* Converts a number into a text representation with the given radix (base).
|
|
|
65 |
*
|
|
|
66 |
* Excel Function:
|
|
|
67 |
* BASE(Number, Radix [Min_length])
|
|
|
68 |
*
|
|
|
69 |
* @deprecated 1.18.0
|
|
|
70 |
* Use the evaluate method in the MathTrig\Base class instead
|
|
|
71 |
* @see MathTrig\Base::evaluate()
|
|
|
72 |
*
|
|
|
73 |
* @param float $number
|
|
|
74 |
* @param float $radix
|
|
|
75 |
* @param int $minLength
|
|
|
76 |
*
|
|
|
77 |
* @return array|string the text representation with the given radix (base)
|
|
|
78 |
*/
|
|
|
79 |
public static function BASE($number, $radix, $minLength = null)
|
|
|
80 |
{
|
|
|
81 |
return MathTrig\Base::evaluate($number, $radix, $minLength);
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
* CEILING.
|
|
|
86 |
*
|
|
|
87 |
* Returns number rounded up, away from zero, to the nearest multiple of significance.
|
|
|
88 |
* For example, if you want to avoid using pennies in your prices and your product is
|
|
|
89 |
* priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the
|
|
|
90 |
* nearest nickel.
|
|
|
91 |
*
|
|
|
92 |
* Excel Function:
|
|
|
93 |
* CEILING(number[,significance])
|
|
|
94 |
*
|
|
|
95 |
* @deprecated 1.17.0
|
|
|
96 |
* Use the ceiling() method in the MathTrig\Ceiling class instead
|
|
|
97 |
* @see MathTrig\Ceiling::ceiling()
|
|
|
98 |
*
|
|
|
99 |
* @param float $number the number you want to round
|
|
|
100 |
* @param float $significance the multiple to which you want to round
|
|
|
101 |
*
|
|
|
102 |
* @return array|float|string Rounded Number, or a string containing an error
|
|
|
103 |
*/
|
|
|
104 |
public static function CEILING($number, $significance = null)
|
|
|
105 |
{
|
|
|
106 |
return MathTrig\Ceiling::ceiling($number, $significance);
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
/**
|
|
|
110 |
* COMBIN.
|
|
|
111 |
*
|
|
|
112 |
* Returns the number of combinations for a given number of items. Use COMBIN to
|
|
|
113 |
* determine the total possible number of groups for a given number of items.
|
|
|
114 |
*
|
|
|
115 |
* Excel Function:
|
|
|
116 |
* COMBIN(numObjs,numInSet)
|
|
|
117 |
*
|
|
|
118 |
* @deprecated 1.18.0
|
|
|
119 |
* Use the withoutRepetition() method in the MathTrig\Combinations class instead
|
|
|
120 |
* @see MathTrig\Combinations::withoutRepetition()
|
|
|
121 |
*
|
|
|
122 |
* @param array|int $numObjs Number of different objects
|
|
|
123 |
* @param array|int $numInSet Number of objects in each combination
|
|
|
124 |
*
|
|
|
125 |
* @return array|float|int|string Number of combinations, or a string containing an error
|
|
|
126 |
*/
|
|
|
127 |
public static function COMBIN($numObjs, $numInSet)
|
|
|
128 |
{
|
|
|
129 |
return MathTrig\Combinations::withoutRepetition($numObjs, $numInSet);
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
/**
|
|
|
133 |
* EVEN.
|
|
|
134 |
*
|
|
|
135 |
* Returns number rounded up to the nearest even integer.
|
|
|
136 |
* You can use this function for processing items that come in twos. For example,
|
|
|
137 |
* a packing crate accepts rows of one or two items. The crate is full when
|
|
|
138 |
* the number of items, rounded up to the nearest two, matches the crate's
|
|
|
139 |
* capacity.
|
|
|
140 |
*
|
|
|
141 |
* Excel Function:
|
|
|
142 |
* EVEN(number)
|
|
|
143 |
*
|
|
|
144 |
* @deprecated 1.18.0
|
|
|
145 |
* Use the even() method in the MathTrig\Round class instead
|
|
|
146 |
* @see MathTrig\Round::even()
|
|
|
147 |
*
|
|
|
148 |
* @param array|float $number Number to round
|
|
|
149 |
*
|
|
|
150 |
* @return array|float|int|string Rounded Number, or a string containing an error
|
|
|
151 |
*/
|
|
|
152 |
public static function EVEN($number)
|
|
|
153 |
{
|
|
|
154 |
return MathTrig\Round::even($number);
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
/**
|
|
|
158 |
* Helper function for Even.
|
|
|
159 |
*
|
|
|
160 |
* @deprecated 1.18.0
|
|
|
161 |
* Use the evaluate() method in the MathTrig\Helpers class instead
|
|
|
162 |
* @see MathTrig\Helpers::getEven()
|
|
|
163 |
*/
|
|
|
164 |
public static function getEven(float $number): int
|
|
|
165 |
{
|
|
|
166 |
return (int) MathTrig\Helpers::getEven($number);
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
/**
|
|
|
170 |
* FACT.
|
|
|
171 |
*
|
|
|
172 |
* Returns the factorial of a number.
|
|
|
173 |
* The factorial of a number is equal to 1*2*3*...* number.
|
|
|
174 |
*
|
|
|
175 |
* Excel Function:
|
|
|
176 |
* FACT(factVal)
|
|
|
177 |
*
|
|
|
178 |
* @deprecated 1.18.0
|
|
|
179 |
* Use the fact() method in the MathTrig\Factorial class instead
|
|
|
180 |
* @see MathTrig\Factorial::fact()
|
|
|
181 |
*
|
|
|
182 |
* @param array|float $factVal Factorial Value
|
|
|
183 |
*
|
|
|
184 |
* @return array|float|int|string Factorial, or a string containing an error
|
|
|
185 |
*/
|
|
|
186 |
public static function FACT($factVal)
|
|
|
187 |
{
|
|
|
188 |
return MathTrig\Factorial::fact($factVal);
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
/**
|
|
|
192 |
* FACTDOUBLE.
|
|
|
193 |
*
|
|
|
194 |
* Returns the double factorial of a number.
|
|
|
195 |
*
|
|
|
196 |
* Excel Function:
|
|
|
197 |
* FACTDOUBLE(factVal)
|
|
|
198 |
*
|
|
|
199 |
* @deprecated 1.18.0
|
|
|
200 |
* Use the factDouble() method in the MathTrig\Factorial class instead
|
|
|
201 |
* @see MathTrig\Factorial::factDouble()
|
|
|
202 |
*
|
|
|
203 |
* @param array|float $factVal Factorial Value
|
|
|
204 |
*
|
|
|
205 |
* @return array|float|int|string Double Factorial, or a string containing an error
|
|
|
206 |
*/
|
|
|
207 |
public static function FACTDOUBLE($factVal)
|
|
|
208 |
{
|
|
|
209 |
return MathTrig\Factorial::factDouble($factVal);
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
/**
|
|
|
213 |
* FLOOR.
|
|
|
214 |
*
|
|
|
215 |
* Rounds number down, toward zero, to the nearest multiple of significance.
|
|
|
216 |
*
|
|
|
217 |
* Excel Function:
|
|
|
218 |
* FLOOR(number[,significance])
|
|
|
219 |
*
|
|
|
220 |
* @deprecated 1.17.0
|
|
|
221 |
* Use the floor() method in the MathTrig\Floor class instead
|
|
|
222 |
* @see MathTrig\Floor::floor()
|
|
|
223 |
*
|
|
|
224 |
* @param float $number Number to round
|
|
|
225 |
* @param float $significance Significance
|
|
|
226 |
*
|
|
|
227 |
* @return array|float|string Rounded Number, or a string containing an error
|
|
|
228 |
*/
|
|
|
229 |
public static function FLOOR($number, $significance = null)
|
|
|
230 |
{
|
|
|
231 |
return MathTrig\Floor::floor($number, $significance);
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
/**
|
|
|
235 |
* FLOOR.MATH.
|
|
|
236 |
*
|
|
|
237 |
* Round a number down to the nearest integer or to the nearest multiple of significance.
|
|
|
238 |
*
|
|
|
239 |
* Excel Function:
|
|
|
240 |
* FLOOR.MATH(number[,significance[,mode]])
|
|
|
241 |
*
|
|
|
242 |
* @deprecated 1.17.0
|
|
|
243 |
* Use the math() method in the MathTrig\Floor class instead
|
|
|
244 |
* @see MathTrig\Floor::math()
|
|
|
245 |
*
|
|
|
246 |
* @param float $number Number to round
|
|
|
247 |
* @param float $significance Significance
|
|
|
248 |
* @param int $mode direction to round negative numbers
|
|
|
249 |
*
|
|
|
250 |
* @return array|float|string Rounded Number, or a string containing an error
|
|
|
251 |
*/
|
|
|
252 |
public static function FLOORMATH($number, $significance = null, $mode = 0)
|
|
|
253 |
{
|
|
|
254 |
return MathTrig\Floor::math($number, $significance, $mode);
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
/**
|
|
|
258 |
* FLOOR.PRECISE.
|
|
|
259 |
*
|
|
|
260 |
* Rounds number down, toward zero, to the nearest multiple of significance.
|
|
|
261 |
*
|
|
|
262 |
* Excel Function:
|
|
|
263 |
* FLOOR.PRECISE(number[,significance])
|
|
|
264 |
*
|
|
|
265 |
* @deprecated 1.17.0
|
|
|
266 |
* Use the precise() method in the MathTrig\Floor class instead
|
|
|
267 |
* @see MathTrig\Floor::precise()
|
|
|
268 |
*
|
|
|
269 |
* @param float $number Number to round
|
|
|
270 |
* @param float $significance Significance
|
|
|
271 |
*
|
|
|
272 |
* @return array|float|string Rounded Number, or a string containing an error
|
|
|
273 |
*/
|
|
|
274 |
public static function FLOORPRECISE($number, $significance = 1)
|
|
|
275 |
{
|
|
|
276 |
return MathTrig\Floor::precise($number, $significance);
|
|
|
277 |
}
|
|
|
278 |
|
|
|
279 |
/**
|
|
|
280 |
* INT.
|
|
|
281 |
*
|
|
|
282 |
* Casts a floating point value to an integer
|
|
|
283 |
*
|
|
|
284 |
* Excel Function:
|
|
|
285 |
* INT(number)
|
|
|
286 |
*
|
|
|
287 |
* @deprecated 1.17.0
|
|
|
288 |
* Use the evaluate() method in the MathTrig\IntClass class instead
|
|
|
289 |
* @see MathTrig\IntClass::evaluate()
|
|
|
290 |
*
|
|
|
291 |
* @param array|float $number Number to cast to an integer
|
|
|
292 |
*
|
|
|
293 |
* @return array|int|string Integer value, or a string containing an error
|
|
|
294 |
*/
|
|
|
295 |
public static function INT($number)
|
|
|
296 |
{
|
|
|
297 |
return MathTrig\IntClass::evaluate($number);
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
/**
|
|
|
301 |
* GCD.
|
|
|
302 |
*
|
|
|
303 |
* Returns the greatest common divisor of a series of numbers.
|
|
|
304 |
* The greatest common divisor is the largest integer that divides both
|
|
|
305 |
* number1 and number2 without a remainder.
|
|
|
306 |
*
|
|
|
307 |
* Excel Function:
|
|
|
308 |
* GCD(number1[,number2[, ...]])
|
|
|
309 |
*
|
|
|
310 |
* @deprecated 1.18.0
|
|
|
311 |
* Use the evaluate() method in the MathTrig\Gcd class instead
|
|
|
312 |
* @see MathTrig\Gcd::evaluate()
|
|
|
313 |
*
|
|
|
314 |
* @param mixed ...$args Data values
|
|
|
315 |
*
|
|
|
316 |
* @return int|mixed|string Greatest Common Divisor, or a string containing an error
|
|
|
317 |
*/
|
|
|
318 |
public static function GCD(...$args)
|
|
|
319 |
{
|
|
|
320 |
return MathTrig\Gcd::evaluate(...$args);
|
|
|
321 |
}
|
|
|
322 |
|
|
|
323 |
/**
|
|
|
324 |
* LCM.
|
|
|
325 |
*
|
|
|
326 |
* Returns the lowest common multiplier of a series of numbers
|
|
|
327 |
* The least common multiple is the smallest positive integer that is a multiple
|
|
|
328 |
* of all integer arguments number1, number2, and so on. Use LCM to add fractions
|
|
|
329 |
* with different denominators.
|
|
|
330 |
*
|
|
|
331 |
* Excel Function:
|
|
|
332 |
* LCM(number1[,number2[, ...]])
|
|
|
333 |
*
|
|
|
334 |
* @deprecated 1.18.0
|
|
|
335 |
* Use the evaluate() method in the MathTrig\Lcm class instead
|
|
|
336 |
* @see MathTrig\Lcm::evaluate()
|
|
|
337 |
*
|
|
|
338 |
* @param mixed ...$args Data values
|
|
|
339 |
*
|
|
|
340 |
* @return int|string Lowest Common Multiplier, or a string containing an error
|
|
|
341 |
*/
|
|
|
342 |
public static function LCM(...$args)
|
|
|
343 |
{
|
|
|
344 |
return MathTrig\Lcm::evaluate(...$args);
|
|
|
345 |
}
|
|
|
346 |
|
|
|
347 |
/**
|
|
|
348 |
* LOG_BASE.
|
|
|
349 |
*
|
|
|
350 |
* Returns the logarithm of a number to a specified base. The default base is 10.
|
|
|
351 |
*
|
|
|
352 |
* Excel Function:
|
|
|
353 |
* LOG(number[,base])
|
|
|
354 |
*
|
|
|
355 |
* @deprecated 1.18.0
|
|
|
356 |
* Use the withBase() method in the MathTrig\Logarithms class instead
|
|
|
357 |
* @see MathTrig\Logarithms::withBase()
|
|
|
358 |
*
|
|
|
359 |
* @param float $number The positive real number for which you want the logarithm
|
|
|
360 |
* @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10.
|
|
|
361 |
*
|
|
|
362 |
* @return array|float|string The result, or a string containing an error
|
|
|
363 |
*/
|
|
|
364 |
public static function logBase($number, $base = 10)
|
|
|
365 |
{
|
|
|
366 |
return MathTrig\Logarithms::withBase($number, $base);
|
|
|
367 |
}
|
|
|
368 |
|
|
|
369 |
/**
|
|
|
370 |
* MDETERM.
|
|
|
371 |
*
|
|
|
372 |
* Returns the matrix determinant of an array.
|
|
|
373 |
*
|
|
|
374 |
* Excel Function:
|
|
|
375 |
* MDETERM(array)
|
|
|
376 |
*
|
|
|
377 |
* @deprecated 1.18.0
|
|
|
378 |
* Use the determinant() method in the MathTrig\MatrixFunctions class instead
|
|
|
379 |
* @see MathTrig\MatrixFunctions::determinant()
|
|
|
380 |
*
|
|
|
381 |
* @param array $matrixValues A matrix of values
|
|
|
382 |
*
|
|
|
383 |
* @return float|string The result, or a string containing an error
|
|
|
384 |
*/
|
|
|
385 |
public static function MDETERM($matrixValues)
|
|
|
386 |
{
|
|
|
387 |
return MathTrig\MatrixFunctions::determinant($matrixValues);
|
|
|
388 |
}
|
|
|
389 |
|
|
|
390 |
/**
|
|
|
391 |
* MINVERSE.
|
|
|
392 |
*
|
|
|
393 |
* Returns the inverse matrix for the matrix stored in an array.
|
|
|
394 |
*
|
|
|
395 |
* Excel Function:
|
|
|
396 |
* MINVERSE(array)
|
|
|
397 |
*
|
|
|
398 |
* @deprecated 1.18.0
|
|
|
399 |
* Use the inverse() method in the MathTrig\MatrixFunctions class instead
|
|
|
400 |
* @see MathTrig\MatrixFunctions::inverse()
|
|
|
401 |
*
|
|
|
402 |
* @param array $matrixValues A matrix of values
|
|
|
403 |
*
|
|
|
404 |
* @return array|string The result, or a string containing an error
|
|
|
405 |
*/
|
|
|
406 |
public static function MINVERSE($matrixValues)
|
|
|
407 |
{
|
|
|
408 |
return MathTrig\MatrixFunctions::inverse($matrixValues);
|
|
|
409 |
}
|
|
|
410 |
|
|
|
411 |
/**
|
|
|
412 |
* MMULT.
|
|
|
413 |
*
|
|
|
414 |
* @deprecated 1.18.0
|
|
|
415 |
* Use the multiply() method in the MathTrig\MatrixFunctions class instead
|
|
|
416 |
* @see MathTrig\MatrixFunctions::multiply()
|
|
|
417 |
*
|
|
|
418 |
* @param array $matrixData1 A matrix of values
|
|
|
419 |
* @param array $matrixData2 A matrix of values
|
|
|
420 |
*
|
|
|
421 |
* @return array|string The result, or a string containing an error
|
|
|
422 |
*/
|
|
|
423 |
public static function MMULT($matrixData1, $matrixData2)
|
|
|
424 |
{
|
|
|
425 |
return MathTrig\MatrixFunctions::multiply($matrixData1, $matrixData2);
|
|
|
426 |
}
|
|
|
427 |
|
|
|
428 |
/**
|
|
|
429 |
* MOD.
|
|
|
430 |
*
|
|
|
431 |
* @deprecated 1.18.0
|
|
|
432 |
* Use the mod() method in the MathTrig\Operations class instead
|
|
|
433 |
* @see MathTrig\Operations::mod()
|
|
|
434 |
*
|
|
|
435 |
* @param int $a Dividend
|
|
|
436 |
* @param int $b Divisor
|
|
|
437 |
*
|
|
|
438 |
* @return array|float|int|string Remainder, or a string containing an error
|
|
|
439 |
*/
|
|
|
440 |
public static function MOD($a = 1, $b = 1)
|
|
|
441 |
{
|
|
|
442 |
return MathTrig\Operations::mod($a, $b);
|
|
|
443 |
}
|
|
|
444 |
|
|
|
445 |
/**
|
|
|
446 |
* MROUND.
|
|
|
447 |
*
|
|
|
448 |
* Rounds a number to the nearest multiple of a specified value
|
|
|
449 |
*
|
|
|
450 |
* @deprecated 1.17.0
|
|
|
451 |
* Use the multiple() method in the MathTrig\Mround class instead
|
|
|
452 |
* @see MathTrig\Round::multiple()
|
|
|
453 |
*
|
|
|
454 |
* @param float $number Number to round
|
|
|
455 |
* @param array|int $multiple Multiple to which you want to round $number
|
|
|
456 |
*
|
|
|
457 |
* @return array|float|string Rounded Number, or a string containing an error
|
|
|
458 |
*/
|
|
|
459 |
public static function MROUND($number, $multiple)
|
|
|
460 |
{
|
|
|
461 |
return MathTrig\Round::multiple($number, $multiple);
|
|
|
462 |
}
|
|
|
463 |
|
|
|
464 |
/**
|
|
|
465 |
* MULTINOMIAL.
|
|
|
466 |
*
|
|
|
467 |
* Returns the ratio of the factorial of a sum of values to the product of factorials.
|
|
|
468 |
*
|
|
|
469 |
* @deprecated 1.18.0
|
|
|
470 |
* Use the multinomial method in the MathTrig\Factorial class instead
|
|
|
471 |
* @see MathTrig\Factorial::multinomial()
|
|
|
472 |
*
|
|
|
473 |
* @param mixed[] $args An array of mixed values for the Data Series
|
|
|
474 |
*
|
|
|
475 |
* @return float|string The result, or a string containing an error
|
|
|
476 |
*/
|
|
|
477 |
public static function MULTINOMIAL(...$args)
|
|
|
478 |
{
|
|
|
479 |
return MathTrig\Factorial::multinomial(...$args);
|
|
|
480 |
}
|
|
|
481 |
|
|
|
482 |
/**
|
|
|
483 |
* ODD.
|
|
|
484 |
*
|
|
|
485 |
* Returns number rounded up to the nearest odd integer.
|
|
|
486 |
*
|
|
|
487 |
* @deprecated 1.18.0
|
|
|
488 |
* Use the odd method in the MathTrig\Round class instead
|
|
|
489 |
* @see MathTrig\Round::odd()
|
|
|
490 |
*
|
|
|
491 |
* @param array|float $number Number to round
|
|
|
492 |
*
|
|
|
493 |
* @return array|float|int|string Rounded Number, or a string containing an error
|
|
|
494 |
*/
|
|
|
495 |
public static function ODD($number)
|
|
|
496 |
{
|
|
|
497 |
return MathTrig\Round::odd($number);
|
|
|
498 |
}
|
|
|
499 |
|
|
|
500 |
/**
|
|
|
501 |
* POWER.
|
|
|
502 |
*
|
|
|
503 |
* Computes x raised to the power y.
|
|
|
504 |
*
|
|
|
505 |
* @deprecated 1.18.0
|
|
|
506 |
* Use the evaluate method in the MathTrig\Power class instead
|
|
|
507 |
* @see MathTrig\Operations::power()
|
|
|
508 |
*
|
|
|
509 |
* @param float $x
|
|
|
510 |
* @param float $y
|
|
|
511 |
*
|
|
|
512 |
* @return array|float|int|string The result, or a string containing an error
|
|
|
513 |
*/
|
|
|
514 |
public static function POWER($x = 0, $y = 2)
|
|
|
515 |
{
|
|
|
516 |
return MathTrig\Operations::power($x, $y);
|
|
|
517 |
}
|
|
|
518 |
|
|
|
519 |
/**
|
|
|
520 |
* PRODUCT.
|
|
|
521 |
*
|
|
|
522 |
* PRODUCT returns the product of all the values and cells referenced in the argument list.
|
|
|
523 |
*
|
|
|
524 |
* @deprecated 1.18.0
|
|
|
525 |
* Use the product method in the MathTrig\Operations class instead
|
|
|
526 |
* @see MathTrig\Operations::product()
|
|
|
527 |
*
|
|
|
528 |
* Excel Function:
|
|
|
529 |
* PRODUCT(value1[,value2[, ...]])
|
|
|
530 |
*
|
|
|
531 |
* @param mixed ...$args Data values
|
|
|
532 |
*
|
|
|
533 |
* @return float|string
|
|
|
534 |
*/
|
|
|
535 |
public static function PRODUCT(...$args)
|
|
|
536 |
{
|
|
|
537 |
return MathTrig\Operations::product(...$args);
|
|
|
538 |
}
|
|
|
539 |
|
|
|
540 |
/**
|
|
|
541 |
* QUOTIENT.
|
|
|
542 |
*
|
|
|
543 |
* QUOTIENT function returns the integer portion of a division. Numerator is the divided number
|
|
|
544 |
* and denominator is the divisor.
|
|
|
545 |
*
|
|
|
546 |
* @deprecated 1.18.0
|
|
|
547 |
* Use the quotient method in the MathTrig\Operations class instead
|
|
|
548 |
* @see MathTrig\Operations::quotient()
|
|
|
549 |
*
|
|
|
550 |
* Excel Function:
|
|
|
551 |
* QUOTIENT(value1[,value2[, ...]])
|
|
|
552 |
*
|
|
|
553 |
* @param mixed $numerator
|
|
|
554 |
* @param mixed $denominator
|
|
|
555 |
*
|
|
|
556 |
* @return array|int|string
|
|
|
557 |
*/
|
|
|
558 |
public static function QUOTIENT($numerator, $denominator)
|
|
|
559 |
{
|
|
|
560 |
return MathTrig\Operations::quotient($numerator, $denominator);
|
|
|
561 |
}
|
|
|
562 |
|
|
|
563 |
/**
|
|
|
564 |
* RAND/RANDBETWEEN.
|
|
|
565 |
*
|
|
|
566 |
* @deprecated 1.18.0
|
|
|
567 |
* Use the randBetween or randBetween method in the MathTrig\Random class instead
|
|
|
568 |
* @see MathTrig\Random::randBetween()
|
|
|
569 |
*
|
|
|
570 |
* @param int $min Minimal value
|
|
|
571 |
* @param int $max Maximal value
|
|
|
572 |
*
|
|
|
573 |
* @return array|float|int|string Random number
|
|
|
574 |
*/
|
|
|
575 |
public static function RAND($min = 0, $max = 0)
|
|
|
576 |
{
|
|
|
577 |
return MathTrig\Random::randBetween($min, $max);
|
|
|
578 |
}
|
|
|
579 |
|
|
|
580 |
/**
|
|
|
581 |
* ROMAN.
|
|
|
582 |
*
|
|
|
583 |
* Converts a number to Roman numeral
|
|
|
584 |
*
|
|
|
585 |
* @deprecated 1.17.0
|
|
|
586 |
* Use the evaluate() method in the MathTrig\Roman class instead
|
|
|
587 |
* @see MathTrig\Roman::evaluate()
|
|
|
588 |
*
|
|
|
589 |
* @param mixed $aValue Number to convert
|
|
|
590 |
* @param mixed $style Number indicating one of five possible forms
|
|
|
591 |
*
|
|
|
592 |
* @return array|string Roman numeral, or a string containing an error
|
|
|
593 |
*/
|
|
|
594 |
public static function ROMAN($aValue, $style = 0)
|
|
|
595 |
{
|
|
|
596 |
return MathTrig\Roman::evaluate($aValue, $style);
|
|
|
597 |
}
|
|
|
598 |
|
|
|
599 |
/**
|
|
|
600 |
* ROUNDUP.
|
|
|
601 |
*
|
|
|
602 |
* Rounds a number up to a specified number of decimal places
|
|
|
603 |
*
|
|
|
604 |
* @deprecated 1.17.0
|
|
|
605 |
* Use the up() method in the MathTrig\Round class instead
|
|
|
606 |
* @see MathTrig\Round::up()
|
|
|
607 |
*
|
|
|
608 |
* @param array|float $number Number to round
|
|
|
609 |
* @param array|int $digits Number of digits to which you want to round $number
|
|
|
610 |
*
|
|
|
611 |
* @return array|float|string Rounded Number, or a string containing an error
|
|
|
612 |
*/
|
|
|
613 |
public static function ROUNDUP($number, $digits)
|
|
|
614 |
{
|
|
|
615 |
return MathTrig\Round::up($number, $digits);
|
|
|
616 |
}
|
|
|
617 |
|
|
|
618 |
/**
|
|
|
619 |
* ROUNDDOWN.
|
|
|
620 |
*
|
|
|
621 |
* Rounds a number down to a specified number of decimal places
|
|
|
622 |
*
|
|
|
623 |
* @deprecated 1.17.0
|
|
|
624 |
* Use the down() method in the MathTrig\Round class instead
|
|
|
625 |
* @see MathTrig\Round::down()
|
|
|
626 |
*
|
|
|
627 |
* @param array|float $number Number to round
|
|
|
628 |
* @param array|int $digits Number of digits to which you want to round $number
|
|
|
629 |
*
|
|
|
630 |
* @return array|float|string Rounded Number, or a string containing an error
|
|
|
631 |
*/
|
|
|
632 |
public static function ROUNDDOWN($number, $digits)
|
|
|
633 |
{
|
|
|
634 |
return MathTrig\Round::down($number, $digits);
|
|
|
635 |
}
|
|
|
636 |
|
|
|
637 |
/**
|
|
|
638 |
* SERIESSUM.
|
|
|
639 |
*
|
|
|
640 |
* Returns the sum of a power series
|
|
|
641 |
*
|
|
|
642 |
* @deprecated 1.18.0
|
|
|
643 |
* Use the evaluate method in the MathTrig\SeriesSum class instead
|
|
|
644 |
* @see MathTrig\SeriesSum::evaluate()
|
|
|
645 |
*
|
|
|
646 |
* @param mixed $x Input value
|
|
|
647 |
* @param mixed $n Initial power
|
|
|
648 |
* @param mixed $m Step
|
|
|
649 |
* @param mixed[] $args An array of coefficients for the Data Series
|
|
|
650 |
*
|
|
|
651 |
* @return array|float|string The result, or a string containing an error
|
|
|
652 |
*/
|
|
|
653 |
public static function SERIESSUM($x, $n, $m, ...$args)
|
|
|
654 |
{
|
|
|
655 |
return MathTrig\SeriesSum::evaluate($x, $n, $m, ...$args);
|
|
|
656 |
}
|
|
|
657 |
|
|
|
658 |
/**
|
|
|
659 |
* SIGN.
|
|
|
660 |
*
|
|
|
661 |
* Determines the sign of a number. Returns 1 if the number is positive, zero (0)
|
|
|
662 |
* if the number is 0, and -1 if the number is negative.
|
|
|
663 |
*
|
|
|
664 |
* @deprecated 1.18.0
|
|
|
665 |
* Use the evaluate method in the MathTrig\Sign class instead
|
|
|
666 |
* @see MathTrig\Sign::evaluate()
|
|
|
667 |
*
|
|
|
668 |
* @param array|float $number Number to round
|
|
|
669 |
*
|
|
|
670 |
* @return array|int|string sign value, or a string containing an error
|
|
|
671 |
*/
|
|
|
672 |
public static function SIGN($number)
|
|
|
673 |
{
|
|
|
674 |
return MathTrig\Sign::evaluate($number);
|
|
|
675 |
}
|
|
|
676 |
|
|
|
677 |
/**
|
|
|
678 |
* returnSign = returns 0/-1/+1.
|
|
|
679 |
*
|
|
|
680 |
* @deprecated 1.18.0
|
|
|
681 |
* Use the returnSign method in the MathTrig\Helpers class instead
|
|
|
682 |
* @see MathTrig\Helpers::returnSign()
|
|
|
683 |
*/
|
|
|
684 |
public static function returnSign(float $number): int
|
|
|
685 |
{
|
|
|
686 |
return MathTrig\Helpers::returnSign($number);
|
|
|
687 |
}
|
|
|
688 |
|
|
|
689 |
/**
|
|
|
690 |
* SQRTPI.
|
|
|
691 |
*
|
|
|
692 |
* Returns the square root of (number * pi).
|
|
|
693 |
*
|
|
|
694 |
* @deprecated 1.18.0
|
|
|
695 |
* Use the pi method in the MathTrig\Sqrt class instead
|
|
|
696 |
* @see MathTrig\Sqrt::sqrt()
|
|
|
697 |
*
|
|
|
698 |
* @param array|float $number Number
|
|
|
699 |
*
|
|
|
700 |
* @return array|float|string Square Root of Number * Pi, or a string containing an error
|
|
|
701 |
*/
|
|
|
702 |
public static function SQRTPI($number)
|
|
|
703 |
{
|
|
|
704 |
return MathTrig\Sqrt::pi($number);
|
|
|
705 |
}
|
|
|
706 |
|
|
|
707 |
/**
|
|
|
708 |
* SUBTOTAL.
|
|
|
709 |
*
|
|
|
710 |
* Returns a subtotal in a list or database.
|
|
|
711 |
*
|
|
|
712 |
* @deprecated 1.18.0
|
|
|
713 |
* Use the evaluate method in the MathTrig\Subtotal class instead
|
|
|
714 |
* @see MathTrig\Subtotal::evaluate()
|
|
|
715 |
*
|
|
|
716 |
* @param int $functionType
|
|
|
717 |
* A number 1 to 11 that specifies which function to
|
|
|
718 |
* use in calculating subtotals within a range
|
|
|
719 |
* list
|
|
|
720 |
* Numbers 101 to 111 shadow the functions of 1 to 11
|
|
|
721 |
* but ignore any values in the range that are
|
|
|
722 |
* in hidden rows or columns
|
|
|
723 |
* @param mixed[] $args A mixed data series of values
|
|
|
724 |
*
|
|
|
725 |
* @return float|string
|
|
|
726 |
*/
|
|
|
727 |
public static function SUBTOTAL($functionType, ...$args)
|
|
|
728 |
{
|
|
|
729 |
return MathTrig\Subtotal::evaluate($functionType, ...$args);
|
|
|
730 |
}
|
|
|
731 |
|
|
|
732 |
/**
|
|
|
733 |
* SUM.
|
|
|
734 |
*
|
|
|
735 |
* SUM computes the sum of all the values and cells referenced in the argument list.
|
|
|
736 |
*
|
|
|
737 |
* @deprecated 1.18.0
|
|
|
738 |
* Use the sumErroringStrings method in the MathTrig\Sum class instead
|
|
|
739 |
* @see MathTrig\Sum::sumErroringStrings()
|
|
|
740 |
*
|
|
|
741 |
* Excel Function:
|
|
|
742 |
* SUM(value1[,value2[, ...]])
|
|
|
743 |
*
|
|
|
744 |
* @param mixed ...$args Data values
|
|
|
745 |
*
|
|
|
746 |
* @return float|string
|
|
|
747 |
*/
|
|
|
748 |
public static function SUM(...$args)
|
|
|
749 |
{
|
|
|
750 |
return MathTrig\Sum::sumIgnoringStrings(...$args);
|
|
|
751 |
}
|
|
|
752 |
|
|
|
753 |
/**
|
|
|
754 |
* SUMIF.
|
|
|
755 |
*
|
|
|
756 |
* Totals the values of cells that contain numbers within the list of arguments
|
|
|
757 |
*
|
|
|
758 |
* Excel Function:
|
|
|
759 |
* SUMIF(range, criteria, [sum_range])
|
|
|
760 |
*
|
|
|
761 |
* @deprecated 1.17.0
|
|
|
762 |
* Use the SUMIF() method in the Statistical\Conditional class instead
|
|
|
763 |
* @see Statistical\Conditional::SUMIF()
|
|
|
764 |
*
|
|
|
765 |
* @param mixed $range Data values
|
|
|
766 |
* @param string $criteria the criteria that defines which cells will be summed
|
|
|
767 |
* @param mixed $sumRange
|
|
|
768 |
*
|
|
|
769 |
* @return null|float|string
|
|
|
770 |
*/
|
|
|
771 |
public static function SUMIF($range, $criteria, $sumRange = [])
|
|
|
772 |
{
|
|
|
773 |
return Statistical\Conditional::SUMIF($range, $criteria, $sumRange);
|
|
|
774 |
}
|
|
|
775 |
|
|
|
776 |
/**
|
|
|
777 |
* SUMIFS.
|
|
|
778 |
*
|
|
|
779 |
* Totals the values of cells that contain numbers within the list of arguments
|
|
|
780 |
*
|
|
|
781 |
* Excel Function:
|
|
|
782 |
* SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
|
|
|
783 |
*
|
|
|
784 |
* @deprecated 1.17.0
|
|
|
785 |
* Use the SUMIFS() method in the Statistical\Conditional class instead
|
|
|
786 |
* @see Statistical\Conditional::SUMIFS()
|
|
|
787 |
*
|
|
|
788 |
* @param mixed $args Data values
|
|
|
789 |
*
|
|
|
790 |
* @return null|float|string
|
|
|
791 |
*/
|
|
|
792 |
public static function SUMIFS(...$args)
|
|
|
793 |
{
|
|
|
794 |
return Statistical\Conditional::SUMIFS(...$args);
|
|
|
795 |
}
|
|
|
796 |
|
|
|
797 |
/**
|
|
|
798 |
* SUMPRODUCT.
|
|
|
799 |
*
|
|
|
800 |
* Excel Function:
|
|
|
801 |
* SUMPRODUCT(value1[,value2[, ...]])
|
|
|
802 |
*
|
|
|
803 |
* @deprecated 1.18.0
|
|
|
804 |
* Use the product method in the MathTrig\Sum class instead
|
|
|
805 |
* @see MathTrig\Sum::product()
|
|
|
806 |
*
|
|
|
807 |
* @param mixed ...$args Data values
|
|
|
808 |
*
|
|
|
809 |
* @return float|string The result, or a string containing an error
|
|
|
810 |
*/
|
|
|
811 |
public static function SUMPRODUCT(...$args)
|
|
|
812 |
{
|
|
|
813 |
return MathTrig\Sum::product(...$args);
|
|
|
814 |
}
|
|
|
815 |
|
|
|
816 |
/**
|
|
|
817 |
* SUMSQ.
|
|
|
818 |
*
|
|
|
819 |
* SUMSQ returns the sum of the squares of the arguments
|
|
|
820 |
*
|
|
|
821 |
* @deprecated 1.18.0
|
|
|
822 |
* Use the sumSquare method in the MathTrig\SumSquares class instead
|
|
|
823 |
* @see MathTrig\SumSquares::sumSquare()
|
|
|
824 |
*
|
|
|
825 |
* Excel Function:
|
|
|
826 |
* SUMSQ(value1[,value2[, ...]])
|
|
|
827 |
*
|
|
|
828 |
* @param mixed ...$args Data values
|
|
|
829 |
*
|
|
|
830 |
* @return float|string
|
|
|
831 |
*/
|
|
|
832 |
public static function SUMSQ(...$args)
|
|
|
833 |
{
|
|
|
834 |
return MathTrig\SumSquares::sumSquare(...$args);
|
|
|
835 |
}
|
|
|
836 |
|
|
|
837 |
/**
|
|
|
838 |
* SUMX2MY2.
|
|
|
839 |
*
|
|
|
840 |
* @deprecated 1.18.0
|
|
|
841 |
* Use the sumXSquaredMinusYSquared method in the MathTrig\SumSquares class instead
|
|
|
842 |
* @see MathTrig\SumSquares::sumXSquaredMinusYSquared()
|
|
|
843 |
*
|
|
|
844 |
* @param mixed[] $matrixData1 Matrix #1
|
|
|
845 |
* @param mixed[] $matrixData2 Matrix #2
|
|
|
846 |
*
|
|
|
847 |
* @return float|string
|
|
|
848 |
*/
|
|
|
849 |
public static function SUMX2MY2($matrixData1, $matrixData2)
|
|
|
850 |
{
|
|
|
851 |
return MathTrig\SumSquares::sumXSquaredMinusYSquared($matrixData1, $matrixData2);
|
|
|
852 |
}
|
|
|
853 |
|
|
|
854 |
/**
|
|
|
855 |
* SUMX2PY2.
|
|
|
856 |
*
|
|
|
857 |
* @deprecated 1.18.0
|
|
|
858 |
* Use the sumXSquaredPlusYSquared method in the MathTrig\SumSquares class instead
|
|
|
859 |
* @see MathTrig\SumSquares::sumXSquaredPlusYSquared()
|
|
|
860 |
*
|
|
|
861 |
* @param mixed[] $matrixData1 Matrix #1
|
|
|
862 |
* @param mixed[] $matrixData2 Matrix #2
|
|
|
863 |
*
|
|
|
864 |
* @return float|string
|
|
|
865 |
*/
|
|
|
866 |
public static function SUMX2PY2($matrixData1, $matrixData2)
|
|
|
867 |
{
|
|
|
868 |
return MathTrig\SumSquares::sumXSquaredPlusYSquared($matrixData1, $matrixData2);
|
|
|
869 |
}
|
|
|
870 |
|
|
|
871 |
/**
|
|
|
872 |
* SUMXMY2.
|
|
|
873 |
*
|
|
|
874 |
* @deprecated 1.18.0
|
|
|
875 |
* Use the sumXMinusYSquared method in the MathTrig\SumSquares class instead
|
|
|
876 |
* @see MathTrig\SumSquares::sumXMinusYSquared()
|
|
|
877 |
*
|
|
|
878 |
* @param mixed[] $matrixData1 Matrix #1
|
|
|
879 |
* @param mixed[] $matrixData2 Matrix #2
|
|
|
880 |
*
|
|
|
881 |
* @return float|string
|
|
|
882 |
*/
|
|
|
883 |
public static function SUMXMY2($matrixData1, $matrixData2)
|
|
|
884 |
{
|
|
|
885 |
return MathTrig\SumSquares::sumXMinusYSquared($matrixData1, $matrixData2);
|
|
|
886 |
}
|
|
|
887 |
|
|
|
888 |
/**
|
|
|
889 |
* TRUNC.
|
|
|
890 |
*
|
|
|
891 |
* Truncates value to the number of fractional digits by number_digits.
|
|
|
892 |
*
|
|
|
893 |
* @deprecated 1.17.0
|
|
|
894 |
* Use the evaluate() method in the MathTrig\Trunc class instead
|
|
|
895 |
* @see MathTrig\Trunc::evaluate()
|
|
|
896 |
*
|
|
|
897 |
* @param float $value
|
|
|
898 |
* @param int $digits
|
|
|
899 |
*
|
|
|
900 |
* @return array|float|string Truncated value, or a string containing an error
|
|
|
901 |
*/
|
|
|
902 |
public static function TRUNC($value = 0, $digits = 0)
|
|
|
903 |
{
|
|
|
904 |
return MathTrig\Trunc::evaluate($value, $digits);
|
|
|
905 |
}
|
|
|
906 |
|
|
|
907 |
/**
|
|
|
908 |
* SEC.
|
|
|
909 |
*
|
|
|
910 |
* Returns the secant of an angle.
|
|
|
911 |
*
|
|
|
912 |
* @deprecated 1.18.0
|
|
|
913 |
* Use the sec method in the MathTrig\Trig\Secant class instead
|
|
|
914 |
* @see MathTrig\Trig\Secant::sec()
|
|
|
915 |
*
|
|
|
916 |
* @param array|float $angle Number
|
|
|
917 |
*
|
|
|
918 |
* @return array|float|string The secant of the angle
|
|
|
919 |
*/
|
|
|
920 |
public static function SEC($angle)
|
|
|
921 |
{
|
|
|
922 |
return MathTrig\Trig\Secant::sec($angle);
|
|
|
923 |
}
|
|
|
924 |
|
|
|
925 |
/**
|
|
|
926 |
* SECH.
|
|
|
927 |
*
|
|
|
928 |
* Returns the hyperbolic secant of an angle.
|
|
|
929 |
*
|
|
|
930 |
* @deprecated 1.18.0
|
|
|
931 |
* Use the sech method in the MathTrig\Trig\Secant class instead
|
|
|
932 |
* @see MathTrig\Trig\Secant::sech()
|
|
|
933 |
*
|
|
|
934 |
* @param array|float $angle Number
|
|
|
935 |
*
|
|
|
936 |
* @return array|float|string The hyperbolic secant of the angle
|
|
|
937 |
*/
|
|
|
938 |
public static function SECH($angle)
|
|
|
939 |
{
|
|
|
940 |
return MathTrig\Trig\Secant::sech($angle);
|
|
|
941 |
}
|
|
|
942 |
|
|
|
943 |
/**
|
|
|
944 |
* CSC.
|
|
|
945 |
*
|
|
|
946 |
* Returns the cosecant of an angle.
|
|
|
947 |
*
|
|
|
948 |
* @deprecated 1.18.0
|
|
|
949 |
* Use the csc method in the MathTrig\Trig\Cosecant class instead
|
|
|
950 |
* @see MathTrig\Trig\Cosecant::csc()
|
|
|
951 |
*
|
|
|
952 |
* @param array|float $angle Number
|
|
|
953 |
*
|
|
|
954 |
* @return array|float|string The cosecant of the angle
|
|
|
955 |
*/
|
|
|
956 |
public static function CSC($angle)
|
|
|
957 |
{
|
|
|
958 |
return MathTrig\Trig\Cosecant::csc($angle);
|
|
|
959 |
}
|
|
|
960 |
|
|
|
961 |
/**
|
|
|
962 |
* CSCH.
|
|
|
963 |
*
|
|
|
964 |
* Returns the hyperbolic cosecant of an angle.
|
|
|
965 |
*
|
|
|
966 |
* @deprecated 1.18.0
|
|
|
967 |
* Use the csch method in the MathTrig\Trig\Cosecant class instead
|
|
|
968 |
* @see MathTrig\Trig\Cosecant::csch()
|
|
|
969 |
*
|
|
|
970 |
* @param array|float $angle Number
|
|
|
971 |
*
|
|
|
972 |
* @return array|float|string The hyperbolic cosecant of the angle
|
|
|
973 |
*/
|
|
|
974 |
public static function CSCH($angle)
|
|
|
975 |
{
|
|
|
976 |
return MathTrig\Trig\Cosecant::csch($angle);
|
|
|
977 |
}
|
|
|
978 |
|
|
|
979 |
/**
|
|
|
980 |
* COT.
|
|
|
981 |
*
|
|
|
982 |
* Returns the cotangent of an angle.
|
|
|
983 |
*
|
|
|
984 |
* @deprecated 1.18.0
|
|
|
985 |
* Use the cot method in the MathTrig\Trig\Cotangent class instead
|
|
|
986 |
* @see MathTrig\Trig\Cotangent::cot()
|
|
|
987 |
*
|
|
|
988 |
* @param array|float $angle Number
|
|
|
989 |
*
|
|
|
990 |
* @return array|float|string The cotangent of the angle
|
|
|
991 |
*/
|
|
|
992 |
public static function COT($angle)
|
|
|
993 |
{
|
|
|
994 |
return MathTrig\Trig\Cotangent::cot($angle);
|
|
|
995 |
}
|
|
|
996 |
|
|
|
997 |
/**
|
|
|
998 |
* COTH.
|
|
|
999 |
*
|
|
|
1000 |
* Returns the hyperbolic cotangent of an angle.
|
|
|
1001 |
*
|
|
|
1002 |
* @deprecated 1.18.0
|
|
|
1003 |
* Use the coth method in the MathTrig\Trig\Cotangent class instead
|
|
|
1004 |
* @see MathTrig\Trig\Cotangent::coth()
|
|
|
1005 |
*
|
|
|
1006 |
* @param array|float $angle Number
|
|
|
1007 |
*
|
|
|
1008 |
* @return array|float|string The hyperbolic cotangent of the angle
|
|
|
1009 |
*/
|
|
|
1010 |
public static function COTH($angle)
|
|
|
1011 |
{
|
|
|
1012 |
return MathTrig\Trig\Cotangent::coth($angle);
|
|
|
1013 |
}
|
|
|
1014 |
|
|
|
1015 |
/**
|
|
|
1016 |
* ACOT.
|
|
|
1017 |
*
|
|
|
1018 |
* Returns the arccotangent of a number.
|
|
|
1019 |
*
|
|
|
1020 |
* @deprecated 1.18.0
|
|
|
1021 |
* Use the acot method in the MathTrig\Trig\Cotangent class instead
|
|
|
1022 |
* @see MathTrig\Trig\Cotangent::acot()
|
|
|
1023 |
*
|
|
|
1024 |
* @param array|float $number Number
|
|
|
1025 |
*
|
|
|
1026 |
* @return array|float|string The arccotangent of the number
|
|
|
1027 |
*/
|
|
|
1028 |
public static function ACOT($number)
|
|
|
1029 |
{
|
|
|
1030 |
return MathTrig\Trig\Cotangent::acot($number);
|
|
|
1031 |
}
|
|
|
1032 |
|
|
|
1033 |
/**
|
|
|
1034 |
* Return NAN or value depending on argument.
|
|
|
1035 |
*
|
|
|
1036 |
* @deprecated 1.18.0
|
|
|
1037 |
* Use the numberOrNan method in the MathTrig\Helpers class instead
|
|
|
1038 |
* @see MathTrig\Helpers::numberOrNan()
|
|
|
1039 |
*
|
|
|
1040 |
* @param float $result Number
|
|
|
1041 |
*
|
|
|
1042 |
* @return float|string
|
|
|
1043 |
*/
|
|
|
1044 |
public static function numberOrNan($result)
|
|
|
1045 |
{
|
|
|
1046 |
return MathTrig\Helpers::numberOrNan($result);
|
|
|
1047 |
}
|
|
|
1048 |
|
|
|
1049 |
/**
|
|
|
1050 |
* ACOTH.
|
|
|
1051 |
*
|
|
|
1052 |
* Returns the hyperbolic arccotangent of a number.
|
|
|
1053 |
*
|
|
|
1054 |
* @deprecated 1.18.0
|
|
|
1055 |
* Use the acoth method in the MathTrig\Trig\Cotangent class instead
|
|
|
1056 |
* @see MathTrig\Trig\Cotangent::acoth()
|
|
|
1057 |
*
|
|
|
1058 |
* @param array|float $number Number
|
|
|
1059 |
*
|
|
|
1060 |
* @return array|float|string The hyperbolic arccotangent of the number
|
|
|
1061 |
*/
|
|
|
1062 |
public static function ACOTH($number)
|
|
|
1063 |
{
|
|
|
1064 |
return MathTrig\Trig\Cotangent::acoth($number);
|
|
|
1065 |
}
|
|
|
1066 |
|
|
|
1067 |
/**
|
|
|
1068 |
* ROUND.
|
|
|
1069 |
*
|
|
|
1070 |
* Returns the result of builtin function round after validating args.
|
|
|
1071 |
*
|
|
|
1072 |
* @deprecated 1.17.0
|
|
|
1073 |
* Use the round() method in the MathTrig\Round class instead
|
|
|
1074 |
* @see MathTrig\Round::round()
|
|
|
1075 |
*
|
|
|
1076 |
* @param array|mixed $number Should be numeric
|
|
|
1077 |
* @param array|mixed $precision Should be int
|
|
|
1078 |
*
|
|
|
1079 |
* @return array|float|string Rounded number
|
|
|
1080 |
*/
|
|
|
1081 |
public static function builtinROUND($number, $precision)
|
|
|
1082 |
{
|
|
|
1083 |
return MathTrig\Round::round($number, $precision);
|
|
|
1084 |
}
|
|
|
1085 |
|
|
|
1086 |
/**
|
|
|
1087 |
* ABS.
|
|
|
1088 |
*
|
|
|
1089 |
* Returns the result of builtin function abs after validating args.
|
|
|
1090 |
*
|
|
|
1091 |
* @deprecated 1.18.0
|
|
|
1092 |
* Use the evaluate method in the MathTrig\Absolute class instead
|
|
|
1093 |
* @see MathTrig\Absolute::evaluate()
|
|
|
1094 |
*
|
|
|
1095 |
* @param array|mixed $number Should be numeric
|
|
|
1096 |
*
|
|
|
1097 |
* @return array|float|int|string Rounded number
|
|
|
1098 |
*/
|
|
|
1099 |
public static function builtinABS($number)
|
|
|
1100 |
{
|
|
|
1101 |
return MathTrig\Absolute::evaluate($number);
|
|
|
1102 |
}
|
|
|
1103 |
|
|
|
1104 |
/**
|
|
|
1105 |
* ACOS.
|
|
|
1106 |
*
|
|
|
1107 |
* @deprecated 1.18.0
|
|
|
1108 |
* Use the acos method in the MathTrig\Trig\Cosine class instead
|
|
|
1109 |
* @see MathTrig\Trig\Cosine::acos()
|
|
|
1110 |
*
|
|
|
1111 |
* Returns the result of builtin function acos after validating args.
|
|
|
1112 |
*
|
|
|
1113 |
* @param array|float $number Should be numeric
|
|
|
1114 |
*
|
|
|
1115 |
* @return array|float|string Rounded number
|
|
|
1116 |
*/
|
|
|
1117 |
public static function builtinACOS($number)
|
|
|
1118 |
{
|
|
|
1119 |
return MathTrig\Trig\Cosine::acos($number);
|
|
|
1120 |
}
|
|
|
1121 |
|
|
|
1122 |
/**
|
|
|
1123 |
* ACOSH.
|
|
|
1124 |
*
|
|
|
1125 |
* Returns the result of builtin function acosh after validating args.
|
|
|
1126 |
*
|
|
|
1127 |
* @deprecated 1.18.0
|
|
|
1128 |
* Use the acosh method in the MathTrig\Trig\Cosine class instead
|
|
|
1129 |
* @see MathTrig\Trig\Cosine::acosh()
|
|
|
1130 |
*
|
|
|
1131 |
* @param array|float $number Should be numeric
|
|
|
1132 |
*
|
|
|
1133 |
* @return array|float|string Rounded number
|
|
|
1134 |
*/
|
|
|
1135 |
public static function builtinACOSH($number)
|
|
|
1136 |
{
|
|
|
1137 |
return MathTrig\Trig\Cosine::acosh($number);
|
|
|
1138 |
}
|
|
|
1139 |
|
|
|
1140 |
/**
|
|
|
1141 |
* ASIN.
|
|
|
1142 |
*
|
|
|
1143 |
* Returns the result of builtin function asin after validating args.
|
|
|
1144 |
*
|
|
|
1145 |
* @deprecated 1.18.0
|
|
|
1146 |
* Use the asin method in the MathTrig\Trig\Sine class instead
|
|
|
1147 |
* @see MathTrig\Trig\Sine::asin()
|
|
|
1148 |
*
|
|
|
1149 |
* @param array|float $number Should be numeric
|
|
|
1150 |
*
|
|
|
1151 |
* @return array|float|string Rounded number
|
|
|
1152 |
*/
|
|
|
1153 |
public static function builtinASIN($number)
|
|
|
1154 |
{
|
|
|
1155 |
return MathTrig\Trig\Sine::asin($number);
|
|
|
1156 |
}
|
|
|
1157 |
|
|
|
1158 |
/**
|
|
|
1159 |
* ASINH.
|
|
|
1160 |
*
|
|
|
1161 |
* Returns the result of builtin function asinh after validating args.
|
|
|
1162 |
*
|
|
|
1163 |
* @deprecated 1.18.0
|
|
|
1164 |
* Use the asinh method in the MathTrig\Trig\Sine class instead
|
|
|
1165 |
* @see MathTrig\Trig\Sine::asinh()
|
|
|
1166 |
*
|
|
|
1167 |
* @param array|float $number Should be numeric
|
|
|
1168 |
*
|
|
|
1169 |
* @return array|float|string Rounded number
|
|
|
1170 |
*/
|
|
|
1171 |
public static function builtinASINH($number)
|
|
|
1172 |
{
|
|
|
1173 |
return MathTrig\Trig\Sine::asinh($number);
|
|
|
1174 |
}
|
|
|
1175 |
|
|
|
1176 |
/**
|
|
|
1177 |
* ATAN.
|
|
|
1178 |
*
|
|
|
1179 |
* Returns the result of builtin function atan after validating args.
|
|
|
1180 |
*
|
|
|
1181 |
* @deprecated 1.18.0
|
|
|
1182 |
* Use the atan method in the MathTrig\Trig\Tangent class instead
|
|
|
1183 |
* @see MathTrig\Trig\Tangent::atan()
|
|
|
1184 |
*
|
|
|
1185 |
* @param array|float $number Should be numeric
|
|
|
1186 |
*
|
|
|
1187 |
* @return array|float|string Rounded number
|
|
|
1188 |
*/
|
|
|
1189 |
public static function builtinATAN($number)
|
|
|
1190 |
{
|
|
|
1191 |
return MathTrig\Trig\Tangent::atan($number);
|
|
|
1192 |
}
|
|
|
1193 |
|
|
|
1194 |
/**
|
|
|
1195 |
* ATANH.
|
|
|
1196 |
*
|
|
|
1197 |
* Returns the result of builtin function atanh after validating args.
|
|
|
1198 |
*
|
|
|
1199 |
* @deprecated 1.18.0
|
|
|
1200 |
* Use the atanh method in the MathTrig\Trig\Tangent class instead
|
|
|
1201 |
* @see MathTrig\Trig\Tangent::atanh()
|
|
|
1202 |
*
|
|
|
1203 |
* @param array|float $number Should be numeric
|
|
|
1204 |
*
|
|
|
1205 |
* @return array|float|string Rounded number
|
|
|
1206 |
*/
|
|
|
1207 |
public static function builtinATANH($number)
|
|
|
1208 |
{
|
|
|
1209 |
return MathTrig\Trig\Tangent::atanh($number);
|
|
|
1210 |
}
|
|
|
1211 |
|
|
|
1212 |
/**
|
|
|
1213 |
* COS.
|
|
|
1214 |
*
|
|
|
1215 |
* Returns the result of builtin function cos after validating args.
|
|
|
1216 |
*
|
|
|
1217 |
* @deprecated 1.18.0
|
|
|
1218 |
* Use the cos method in the MathTrig\Trig\Cosine class instead
|
|
|
1219 |
* @see MathTrig\Trig\Cosine::cos()
|
|
|
1220 |
*
|
|
|
1221 |
* @param array|mixed $number Should be numeric
|
|
|
1222 |
*
|
|
|
1223 |
* @return array|float|string Rounded number
|
|
|
1224 |
*/
|
|
|
1225 |
public static function builtinCOS($number)
|
|
|
1226 |
{
|
|
|
1227 |
return MathTrig\Trig\Cosine::cos($number);
|
|
|
1228 |
}
|
|
|
1229 |
|
|
|
1230 |
/**
|
|
|
1231 |
* COSH.
|
|
|
1232 |
*
|
|
|
1233 |
* Returns the result of builtin function cos after validating args.
|
|
|
1234 |
*
|
|
|
1235 |
* @deprecated 1.18.0
|
|
|
1236 |
* Use the cosh method in the MathTrig\Trig\Cosine class instead
|
|
|
1237 |
* @see MathTrig\Trig\Cosine::cosh()
|
|
|
1238 |
*
|
|
|
1239 |
* @param array|mixed $number Should be numeric
|
|
|
1240 |
*
|
|
|
1241 |
* @return array|float|string Rounded number
|
|
|
1242 |
*/
|
|
|
1243 |
public static function builtinCOSH($number)
|
|
|
1244 |
{
|
|
|
1245 |
return MathTrig\Trig\Cosine::cosh($number);
|
|
|
1246 |
}
|
|
|
1247 |
|
|
|
1248 |
/**
|
|
|
1249 |
* DEGREES.
|
|
|
1250 |
*
|
|
|
1251 |
* Returns the result of builtin function rad2deg after validating args.
|
|
|
1252 |
*
|
|
|
1253 |
* @deprecated 1.18.0
|
|
|
1254 |
* Use the toDegrees method in the MathTrig\Angle class instead
|
|
|
1255 |
* @see MathTrig\Angle::toDegrees()
|
|
|
1256 |
*
|
|
|
1257 |
* @param array|mixed $number Should be numeric
|
|
|
1258 |
*
|
|
|
1259 |
* @return array|float|string Rounded number
|
|
|
1260 |
*/
|
|
|
1261 |
public static function builtinDEGREES($number)
|
|
|
1262 |
{
|
|
|
1263 |
return MathTrig\Angle::toDegrees($number);
|
|
|
1264 |
}
|
|
|
1265 |
|
|
|
1266 |
/**
|
|
|
1267 |
* EXP.
|
|
|
1268 |
*
|
|
|
1269 |
* Returns the result of builtin function exp after validating args.
|
|
|
1270 |
*
|
|
|
1271 |
* @deprecated 1.18.0
|
|
|
1272 |
* Use the evaluate method in the MathTrig\Exp class instead
|
|
|
1273 |
* @see MathTrig\Exp::evaluate()
|
|
|
1274 |
*
|
|
|
1275 |
* @param array|mixed $number Should be numeric
|
|
|
1276 |
*
|
|
|
1277 |
* @return array|float|string Rounded number
|
|
|
1278 |
*/
|
|
|
1279 |
public static function builtinEXP($number)
|
|
|
1280 |
{
|
|
|
1281 |
return MathTrig\Exp::evaluate($number);
|
|
|
1282 |
}
|
|
|
1283 |
|
|
|
1284 |
/**
|
|
|
1285 |
* LN.
|
|
|
1286 |
*
|
|
|
1287 |
* Returns the result of builtin function log after validating args.
|
|
|
1288 |
*
|
|
|
1289 |
* @deprecated 1.18.0
|
|
|
1290 |
* Use the natural method in the MathTrig\Logarithms class instead
|
|
|
1291 |
* @see MathTrig\Logarithms::natural()
|
|
|
1292 |
*
|
|
|
1293 |
* @param mixed $number Should be numeric
|
|
|
1294 |
*
|
|
|
1295 |
* @return array|float|string Rounded number
|
|
|
1296 |
*/
|
|
|
1297 |
public static function builtinLN($number)
|
|
|
1298 |
{
|
|
|
1299 |
return MathTrig\Logarithms::natural($number);
|
|
|
1300 |
}
|
|
|
1301 |
|
|
|
1302 |
/**
|
|
|
1303 |
* LOG10.
|
|
|
1304 |
*
|
|
|
1305 |
* Returns the result of builtin function log after validating args.
|
|
|
1306 |
*
|
|
|
1307 |
* @deprecated 1.18.0
|
|
|
1308 |
* Use the natural method in the MathTrig\Logarithms class instead
|
|
|
1309 |
* @see MathTrig\Logarithms::base10()
|
|
|
1310 |
*
|
|
|
1311 |
* @param mixed $number Should be numeric
|
|
|
1312 |
*
|
|
|
1313 |
* @return array|float|string Rounded number
|
|
|
1314 |
*/
|
|
|
1315 |
public static function builtinLOG10($number)
|
|
|
1316 |
{
|
|
|
1317 |
return MathTrig\Logarithms::base10($number);
|
|
|
1318 |
}
|
|
|
1319 |
|
|
|
1320 |
/**
|
|
|
1321 |
* RADIANS.
|
|
|
1322 |
*
|
|
|
1323 |
* Returns the result of builtin function deg2rad after validating args.
|
|
|
1324 |
*
|
|
|
1325 |
* @deprecated 1.18.0
|
|
|
1326 |
* Use the toRadians method in the MathTrig\Angle class instead
|
|
|
1327 |
* @see MathTrig\Angle::toRadians()
|
|
|
1328 |
*
|
|
|
1329 |
* @param array|mixed $number Should be numeric
|
|
|
1330 |
*
|
|
|
1331 |
* @return array|float|string Rounded number
|
|
|
1332 |
*/
|
|
|
1333 |
public static function builtinRADIANS($number)
|
|
|
1334 |
{
|
|
|
1335 |
return MathTrig\Angle::toRadians($number);
|
|
|
1336 |
}
|
|
|
1337 |
|
|
|
1338 |
/**
|
|
|
1339 |
* SIN.
|
|
|
1340 |
*
|
|
|
1341 |
* Returns the result of builtin function sin after validating args.
|
|
|
1342 |
*
|
|
|
1343 |
* @deprecated 1.18.0
|
|
|
1344 |
* Use the sin method in the MathTrig\Trig\Sine class instead
|
|
|
1345 |
* @see MathTrig\Trig\Sine::evaluate()
|
|
|
1346 |
*
|
|
|
1347 |
* @param array|mixed $number Should be numeric
|
|
|
1348 |
*
|
|
|
1349 |
* @return array|float|string sine
|
|
|
1350 |
*/
|
|
|
1351 |
public static function builtinSIN($number)
|
|
|
1352 |
{
|
|
|
1353 |
return MathTrig\Trig\Sine::sin($number);
|
|
|
1354 |
}
|
|
|
1355 |
|
|
|
1356 |
/**
|
|
|
1357 |
* SINH.
|
|
|
1358 |
*
|
|
|
1359 |
* Returns the result of builtin function sinh after validating args.
|
|
|
1360 |
*
|
|
|
1361 |
* @deprecated 1.18.0
|
|
|
1362 |
* Use the sinh method in the MathTrig\Trig\Sine class instead
|
|
|
1363 |
* @see MathTrig\Trig\Sine::sinh()
|
|
|
1364 |
*
|
|
|
1365 |
* @param array|mixed $number Should be numeric
|
|
|
1366 |
*
|
|
|
1367 |
* @return array|float|string Rounded number
|
|
|
1368 |
*/
|
|
|
1369 |
public static function builtinSINH($number)
|
|
|
1370 |
{
|
|
|
1371 |
return MathTrig\Trig\Sine::sinh($number);
|
|
|
1372 |
}
|
|
|
1373 |
|
|
|
1374 |
/**
|
|
|
1375 |
* SQRT.
|
|
|
1376 |
*
|
|
|
1377 |
* Returns the result of builtin function sqrt after validating args.
|
|
|
1378 |
*
|
|
|
1379 |
* @deprecated 1.18.0
|
|
|
1380 |
* Use the sqrt method in the MathTrig\Sqrt class instead
|
|
|
1381 |
* @see MathTrig\Sqrt::sqrt()
|
|
|
1382 |
*
|
|
|
1383 |
* @param array|mixed $number Should be numeric
|
|
|
1384 |
*
|
|
|
1385 |
* @return array|float|string Rounded number
|
|
|
1386 |
*/
|
|
|
1387 |
public static function builtinSQRT($number)
|
|
|
1388 |
{
|
|
|
1389 |
return MathTrig\Sqrt::sqrt($number);
|
|
|
1390 |
}
|
|
|
1391 |
|
|
|
1392 |
/**
|
|
|
1393 |
* TAN.
|
|
|
1394 |
*
|
|
|
1395 |
* Returns the result of builtin function tan after validating args.
|
|
|
1396 |
*
|
|
|
1397 |
* @deprecated 1.18.0
|
|
|
1398 |
* Use the tan method in the MathTrig\Trig\Tangent class instead
|
|
|
1399 |
* @see MathTrig\Trig\Tangent::tan()
|
|
|
1400 |
*
|
|
|
1401 |
* @param array|mixed $number Should be numeric
|
|
|
1402 |
*
|
|
|
1403 |
* @return array|float|string Rounded number
|
|
|
1404 |
*/
|
|
|
1405 |
public static function builtinTAN($number)
|
|
|
1406 |
{
|
|
|
1407 |
return MathTrig\Trig\Tangent::tan($number);
|
|
|
1408 |
}
|
|
|
1409 |
|
|
|
1410 |
/**
|
|
|
1411 |
* TANH.
|
|
|
1412 |
*
|
|
|
1413 |
* Returns the result of builtin function sinh after validating args.
|
|
|
1414 |
*
|
|
|
1415 |
* @deprecated 1.18.0
|
|
|
1416 |
* Use the tanh method in the MathTrig\Trig\Tangent class instead
|
|
|
1417 |
* @see MathTrig\Trig\Tangent::tanh()
|
|
|
1418 |
*
|
|
|
1419 |
* @param array|mixed $number Should be numeric
|
|
|
1420 |
*
|
|
|
1421 |
* @return array|float|string Rounded number
|
|
|
1422 |
*/
|
|
|
1423 |
public static function builtinTANH($number)
|
|
|
1424 |
{
|
|
|
1425 |
return MathTrig\Trig\Tangent::tanh($number);
|
|
|
1426 |
}
|
|
|
1427 |
|
|
|
1428 |
/**
|
|
|
1429 |
* Many functions accept null/false/true argument treated as 0/0/1.
|
|
|
1430 |
*
|
|
|
1431 |
* @deprecated 1.18.0
|
|
|
1432 |
* Use the validateNumericNullBool method in the MathTrig\Helpers class instead
|
|
|
1433 |
* @see MathTrig\Helpers::validateNumericNullBool()
|
|
|
1434 |
*
|
|
|
1435 |
* @param mixed $number
|
|
|
1436 |
*/
|
|
|
1437 |
public static function nullFalseTrueToNumber(&$number): void
|
|
|
1438 |
{
|
|
|
1439 |
$number = Functions::flattenSingleValue($number);
|
|
|
1440 |
if ($number === null) {
|
|
|
1441 |
$number = 0;
|
|
|
1442 |
} elseif (is_bool($number)) {
|
|
|
1443 |
$number = (int) $number;
|
|
|
1444 |
}
|
|
|
1445 |
}
|
|
|
1446 |
}
|