| 1 |
<?php |
| 2 |
|
| 3 |
namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Trig; |
| 4 |
|
| 5 |
use TablePress\PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled; |
| 6 |
use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Exception; |
| 7 |
use TablePress\PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Helpers; |
| 8 |
|
| 9 |
class Sine |
| 10 |
{ |
| 11 |
use ArrayEnabled; |
| 12 |
|
| 13 |
/** |
| 14 |
* SIN. |
| 15 |
* |
| 16 |
* Returns the result of builtin function sin after validating args. |
| 17 |
* |
| 18 |
* @param mixed $angle Should be numeric, or can be an array of numbers |
| 19 |
* |
| 20 |
* @return array<mixed>|float|string sine |
| 21 |
* If an array of numbers is passed as the argument, then the returned result will also be an array |
| 22 |
* with the same dimensions |
| 23 |
*/ |
| 24 |
public static function sin($angle) |
| 25 |
{ |
| 26 |
if (is_array($angle)) { |
| 27 |
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); |
| 28 |
} |
| 29 |
|
| 30 |
try { |
| 31 |
$angle = Helpers::validateNumericNullBool($angle); |
| 32 |
} catch (Exception $e) { |
| 33 |
return $e->getMessage(); |
| 34 |
} |
| 35 |
|
| 36 |
return sin($angle); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* SINH. |
| 41 |
* |
| 42 |
* Returns the result of builtin function sinh after validating args. |
| 43 |
* |
| 44 |
* @param mixed $angle Should be numeric, or can be an array of numbers |
| 45 |
* |
| 46 |
* @return array<mixed>|float|string hyperbolic sine |
| 47 |
* If an array of numbers is passed as the argument, then the returned result will also be an array |
| 48 |
* with the same dimensions |
| 49 |
*/ |
| 50 |
public static function sinh($angle) |
| 51 |
{ |
| 52 |
if (is_array($angle)) { |
| 53 |
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $angle); |
| 54 |
} |
| 55 |
|
| 56 |
try { |
| 57 |
$angle = Helpers::validateNumericNullBool($angle); |
| 58 |
} catch (Exception $e) { |
| 59 |
return $e->getMessage(); |
| 60 |
} |
| 61 |
|
| 62 |
return sinh($angle); |
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* ASIN. |
| 67 |
* |
| 68 |
* Returns the arcsine of a number. |
| 69 |
* |
| 70 |
* @param array<mixed>|float $number Number, or can be an array of numbers |
| 71 |
* |
| 72 |
* @return array<mixed>|float|string The arcsine of the number |
| 73 |
* If an array of numbers is passed as the argument, then the returned result will also be an array |
| 74 |
* with the same dimensions |
| 75 |
*/ |
| 76 |
public static function asin($number) |
| 77 |
{ |
| 78 |
if (is_array($number)) { |
| 79 |
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); |
| 80 |
} |
| 81 |
|
| 82 |
try { |
| 83 |
$number = Helpers::validateNumericNullBool($number); |
| 84 |
} catch (Exception $e) { |
| 85 |
return $e->getMessage(); |
| 86 |
} |
| 87 |
|
| 88 |
return Helpers::numberOrNan(asin($number)); |
| 89 |
} |
| 90 |
|
| 91 |
/** |
| 92 |
* ASINH. |
| 93 |
* |
| 94 |
* Returns the inverse hyperbolic sine of a number. |
| 95 |
* |
| 96 |
* @param array<mixed>|float $number Number, or can be an array of numbers |
| 97 |
* |
| 98 |
* @return array<mixed>|float|string The inverse hyperbolic sine of the number |
| 99 |
* If an array of numbers is passed as the argument, then the returned result will also be an array |
| 100 |
* with the same dimensions |
| 101 |
*/ |
| 102 |
public static function asinh($number) |
| 103 |
{ |
| 104 |
if (is_array($number)) { |
| 105 |
return self::evaluateSingleArgumentArray([self::class, __FUNCTION__], $number); |
| 106 |
} |
| 107 |
|
| 108 |
try { |
| 109 |
$number = Helpers::validateNumericNullBool($number); |
| 110 |
} catch (Exception $e) { |
| 111 |
return $e->getMessage(); |
| 112 |
} |
| 113 |
|
| 114 |
return Helpers::numberOrNan(asinh($number)); |
| 115 |
} |
| 116 |
} |
| 117 |
|