MathTrig.php 41 KB

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