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 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

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