/** * Converts latitude (in degrees) into tile Y coordinate of the tile * (for elliptic Mercator projection) containing the specified point * at a specified level of zoom. * * @param float $latitude Latitude of the point, in degrees.</param> * @param int $zoom Level of detail, from 0 (the whole map as single tile) * to 23 (highest detail). * * @return int The tile Y coordinate. */ function lat_to_tile_y($latitude, $zoom) { $latitude = clip($latitude, -85.05112878, 85.05112878); $sin_lat = sin(deg2rad($latitude)); //$y = 0.5 - log((1 + $sin_lat) / (1 - $sin_lat)) / (4 * pi()); $e = 0.0818191908426; // eccentricity of the Earth $y = 0.5 - (atanh($sin_lat) - $e * atanh($e * $sin_lat)) / (2 * pi()); $size_in_tiles = 1 << $zoom; return min((int) ($y * $size_in_tiles), $size_in_tiles - 1); }
/** * @return $this * @desc 反双曲正切。 */ public function atanh() { $this->current = atanh($this->toDouble()); return $this; }
public function testCanEvaluateHyperbolicFunctions() { $x = $this->variables['x']; $this->assertResult('sinh(0)', 0); $this->assertResult('sinh(x)', sinh($x)); $this->assertResult('cosh(0)', 1); $this->assertResult('cosh(x)', cosh($x)); $this->assertResult('tanh(0)', 0); $this->assertResult('tanh(x)', tanh($x)); $this->assertResult('coth(x)', 1 / tanh($x)); $this->assertResult('arsinh(0)', 0); $this->assertResult('arsinh(x)', asinh($x)); $this->assertResult('arcosh(1)', 0); $this->assertResult('arcosh(3)', acosh(3)); $this->assertResult('artanh(0)', 0); $this->assertResult('artanh(x)', atanh($x)); $this->assertResult('arcoth(3)', atanh(1 / 3)); }
/** * Inverse hyperbolic tangent. * @link http://php.net/manual/en/function.atanh.php * @param float $number <p>The argument to process</p> * @return float Inverse hyperbolic tangent of <i>number</i> */ public static function atanh($number) { return atanh($number); }
/** * Evaluate a FunctionNode * * Computes the value of a FunctionNode `f(x)`, where f is * an elementary function recognized by StdMathLexer and StdMathParser. * * @see \MathParser\Lexer\StdMathLexer StdMathLexer * @see \MathParser\StdMathParser StdMathParser * @throws UnknownFunctionException if the function respresented by the * FunctionNode is *not* recognized. * * @param FunctionNode $node AST to be evaluated * @retval float */ public function visitFunctionNode(FunctionNode $node) { $inner = $node->getOperand()->accept($this); switch ($node->getName()) { // Trigonometric functions case 'sin': return sin($inner); case 'cos': return cos($inner); case 'tan': return tan($inner); case 'cot': return 1 / tan($inner); // Inverse trigonometric functions // Inverse trigonometric functions case 'arcsin': return asin($inner); case 'arccos': return acos($inner); case 'arctan': return atan($inner); case 'arccot': return pi() / 2 - atan($inner); // Exponentials and logarithms // Exponentials and logarithms case 'exp': return exp($inner); case 'log': return log($inner); case 'lg': return log10($inner); // Powers // Powers case 'sqrt': return sqrt($inner); // Hyperbolic functions // Hyperbolic functions case 'sinh': return sinh($inner); case 'cosh': return cosh($inner); case 'tanh': return tanh($inner); case 'coth': return 1 / tanh($inner); // Inverse hyperbolic functions // Inverse hyperbolic functions case 'arsinh': return asinh($inner); case 'arcosh': return acosh($inner); case 'artanh': return atanh($inner); case 'arcoth': return atanh(1 / $inner); default: throw new UnknownFunctionException($node->getName()); } }
/** * Tangente hiperbólica inversa * return Number */ public function atanh() { $this->num = atanh($this->num); return $this; }
<?php /* * proto float atanh(float number) * Function is implemented in ext/standard/math.c */ $file_path = dirname(__FILE__); require $file_path . "/allowed_rounding_error.inc"; echo "atanh 0.46211715726001 = "; var_dump(atanh(0.46211715726001)); if (allowed_rounding_error(atanh(0.46211715726001), 0.5)) { echo "Pass\n"; } else { echo "Fail\n"; } echo "atanh 0.99505475368673 = "; var_dump(atanh(0.99505475368673)); if (allowed_rounding_error(atanh(0.99505475368673), 3.0)) { echo "Pass\n"; } else { echo "Fail\n"; }
/** * This method returns the inverse hyperbolic tangent of this object's value. * * @access public * @static * @param IReal\Type $x the operand * @return IDouble\Type the result */ public static function atanh(IReal\Type $x) : IDouble\Type { return IDouble\Type::box(atanh($x->unbox())); }
/** * Calculates the inverse hyperbolic tangent of a complex number: z = atanh(c1) * * @param Math_Complex $c1 * @return Math_Complex A valid Math_Complex number on success * @throws InvalidArgumentException */ public static function atanh(Math_Complex $c1) { if (!Math_ComplexOp::isComplex($c1)) { throw new InvalidArgumentException('argument is not a Math_Complex object'); } if ($c1->getIm() == 0.0) { $r = $c1->getReal(); if ($r > -1.0 && $r < 1.0) { return Math_Complex(atanh($r), 0.0); } else { return Math_Complex(atanh(1 / $r), $a < 0 ? M_PI_2 : -1 * M_PI_2); } } else { $z = Math_ComplexOp::multIm($c1, 1.0); $z = Math_ComplexOp::atan($z); return Math_ComplexOp::multIm($z, -1.0); } }
VC(pow("2", "8"), 256); VC(pow("-1", "20"), 1); var_dump(pow("0", "0")); var_dump(is_int(pow("2", "32"))); VC(exp(12), 162754.791419); VC(exp(5.7), 298.86740096706); VC(expm1(5.7), 297.8674); var_dump(log10(10)); var_dump(log10(100)); VC(log1p(9), 2.302585092994); VC(log1p(99), 4.6051701859881); VC(log(8), 2.0794415416798); var_dump(log(8, 2)); VC(cos(M_PI), -1); VC(cosh(1.23), 1.8567610569853); VC(sin(deg2rad(90)), 1); VC(sinh(1.23), 1.5644684793044); VC(tan(deg2rad(45)), 1); VC(tanh(1.23), 0.84257932565893); VC(acos(-1), M_PI); VC(acosh(1.8567610569853), 1.23); VC(asin(1), deg2rad(90)); VC(asinh(1.5644684793044), 1.23); VC(atan(1), deg2rad(45)); VC(atanh(0.84257932565893), 1.23); VC(atan2(3, 4), 0.64350110879328); var_dump(hypot(3, 4)); var_dump(fmod(5.7, 1.3)); var_dump(sqrt(9)); var_dump(getrandmax()); var_dump(mt_getrandmax());
private function func(Token $func, &$args) { $functions = array("abs" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return abs($a); }), "acos" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return acos($a); }), "acosh" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return acosh($a); }), "addMonths" => array(2, array(Token::T_NUMBER, Token::T_DATE), Token::T_DATE, function ($a, $b) { return Expression::addMonths($a, $b); }), "asin" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return asin($a); }), "asinh" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return asinh($a); }), "atan" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return atan($a); }), "atan2" => array(2, array(Token::T_NUMBER, Token::T_NUMBER), Token::T_NUMBER, function ($a, $b) { return atan2($a, $b); }), "atanh" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return atanh($a); }), "ceil" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return ceil($a); }), "concat" => array(-1, array(Token::T_TEXT), Token::T_TEXT, function ($a) { $s = ''; foreach ($a as $v) { $s .= isset($v) ? $v : ''; } return $s; }), "cos" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return cos($a); }), "cosh" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return cosh($a); }), "count" => array(-1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { $c = 0; foreach ($a as $v) { if (isset($v)) { $c += 1; } } return $c; }), "day" => array(1, array(Token::T_DATE), Token::T_NUMBER, function ($a) { return (double) $a->format('d'); }), "exp" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return exp($a); }), "firstDayOfMonth" => array(1, array(Token::T_DATE), Token::T_DATE, function ($a) { return Expression::firstDayOfMonth($a); }), "floor" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return floor($a); }), "fullmonth" => array(1, array(Token::T_DATE), Token::T_TEXT, function ($a) { $months = array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"); return $months[(int) $a->format('m') - 1] . ' ' . $a->format('Y'); }), "get" => array(2, array(Token::T_ARRAY, Token::T_NUMBER), Token::T_TEXT, function ($a, $b) { return isset($a[$b - 1]) ? $a[$b - 1] : ""; }), "lastday" => array(2, array(Token::T_NUMBER, Token::T_NUMBER), Token::T_NUMBER, function ($a, $b) { return Expression::lastDay($b, $a); }), "lastDayOfMonth" => array(1, array(Token::T_DATE), Token::T_DATE, function ($a) { return Expression::lastDayOfMonth($a); }), "length" => array(1, array(Token::T_TEXT), Token::T_NUMBER, function ($a) { return mb_strlen($a, 'utf8'); }), "log" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return log($a); }), "log10" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return log10($a); }), "lower" => array(1, array(Token::T_TEXT), Token::T_TEXT, function ($a) { return strtolower($a); }), "match" => array(2, array(Token::T_TEXT, Token::T_TEXT), Token::T_BOOLEAN, function ($a, $b) { return preg_match($a, $b); }), "max" => array(2, array(Token::T_NUMBER, Token::T_NUMBER), Token::T_NUMBER, function ($a, $b) { return max($a, $b); }), "min" => array(2, array(Token::T_NUMBER, Token::T_NUMBER), Token::T_NUMBER, function ($a, $b) { return min($a, $b); }), "money" => array(1, array(Token::T_NUMBER), Token::T_TEXT, function ($a) { return (string) number_format($a, 2, ",", " "); }), "month" => array(1, array(Token::T_DATE), Token::T_NUMBER, function ($a) { return (double) $a->format('m'); }), "nextWorkDay" => array(1, array(Token::T_DATE), Token::T_DATE, function ($a) { return Expression::nextWorkingDay($a); }), "pow" => array(2, array(Token::T_NUMBER, Token::T_NUMBER), Token::T_NUMBER, function ($a, $b) { return pow($a, $b); }), "rand" => array(0, array(), Token::T_NUMBER, function () { return rand(); }), "replace" => array(3, array(Token::T_TEXT, Token::T_TEXT, Token::T_TEXT), Token::T_TEXT, function ($a, $b, $c) { return str_replace($a, $b, $c); }), "round" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return round($a); }), "sin" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return sin($a); }), "sinh" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return sinh($a); }), "size" => array(1, array(Token::T_ARRAY), Token::T_NUMBER, function ($a) { return count($a); }), "split" => array(2, array(Token::T_TEXT, Token::T_TEXT), Token::T_ARRAY, function ($a, $b) { return explode($a, $b); }), "sqrt" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return sqrt($a); }), "substr" => array(3, array(Token::T_TEXT, Token::T_NUMBER, Token::T_NUMBER), Token::T_TEXT, function ($a, $b, $c) { return substr($a, $b - 1, $c); }), "sum" => array(-1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { $s = 0; foreach ($a as $v) { if (isset($v)) { $s += $v; } } return $s; }), "tan" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return tan($a); }), "tanh" => array(1, array(Token::T_NUMBER), Token::T_NUMBER, function ($a) { return tanh($a); }), "upper" => array(1, array(Token::T_TEXT), Token::T_TEXT, function ($a) { return strtoupper($a); }), "workdays" => array(2, array(Token::T_DATE, Token::T_DATE), Token::T_NUMBER, function ($a, $b) { return Expression::workdays($a, $b); }), "year" => array(1, array(Token::T_DATE), Token::T_NUMBER, function ($a) { return (double) $a->format('Y'); })); if ($func->value == "defined") { if (count($args) < 1) { throw new \Exception("Illegal number (" . count($args) . ") of operands for function" . $func); } $arg = array_pop($args); if ($arg->isVariable()) { return new Token(Token::T_BOOLEAN, false); } if ($arg->value === null || $arg->value == "") { return new Token(Token::T_BOOLEAN, false); } return new Token(Token::T_BOOLEAN, true); } if (!isset($functions[$func->value])) { throw new \Exception("Unknown function : " . $func); } $argc = $functions[$func->value][0]; $variableArgsCount = false; if ($argc == -1) { $argc = count($args); $variableArgsCount = true; } if (count($args) < $argc) { throw new \Exception("Illegal number (" . count($args) . ") of operands for function" . $func); } $argv = array(); for (; $argc > 0; --$argc) { $arg = array_pop($args); if (!$variableArgsCount) { if ($arg->isVariable()) { return new Token(Token::T_UNDEFINED, array($arg)); } $type = $functions[$func->value][1][$argc - 1]; if ($arg->type != $type) { $expected = ""; switch ($type) { case Token::T_NUMBER: $expected = "number"; break; case Token::T_DATE: $expected = "date"; break; case Token::T_BOOLEAN: $expected = "boolean"; break; case Token::T_TEXT: $expected = "text"; break; case Token::T_ARRAY: $expected = "array"; break; } throw new \Exception("Illegal type for argument '" . $arg . "' : operand must be a " . $expected . " for " . $func); } array_unshift($argv, $arg->value); } else { if ($arg->isVariable()) { unset($arg->value); } else { array_unshift($argv, $arg->value); } } } if ($variableArgsCount) { $argv = array($argv); } return new Token($functions[$func->value][2], call_user_func_array($functions[$func->value][3], $argv)); }
public static function arcTgH($x) { return atanh($x); }
/** * Inverse hyperbolic cotangent. * * @param float $arg The hyperbolic cotangent of the angle. * * @return float The angle in radians corresponding to `$arg`. */ public static function arcoth($arg) { return atanh(1 / $arg); }
<?php /* * proto float atanh(float number) * Function is implemented in ext/standard/math.c */ $arg_0 = 1.0; $extra_arg = 1; echo "\nToo many arguments\n"; var_dump(atanh($arg_0, $extra_arg)); echo "\nToo few arguments\n"; var_dump(atanh());
public function atanhHook(&$parser, $expr = '') { try { $res = $this->exprParser->doExpression($expr); } catch (ExprError $e) { return $e->getMessage(); } if (function_exists('atanh')) { $result = atanh($res); } else { $result = log(sqrt(1 - $res ^ 2) / (1 - $res)); } return $this->check($result); }
public function getInverseHiperbolicTangentOf() { $this->lastOutputValue = atanh($this->calcLeftNumber); return $this->lastOutputValue; }
function latToY($latitude, $zoom) { return round((atanh(sin(deg2rad(-$latitude))) / pi() + 1) * totalPixelsForZoomLevel($zoom - 1)); }
function lambert93ToWgs84($x, $y) { $x = number_format($x, 10, '.', ''); $y = number_format($y, 10, '.', ''); $b6 = 6378137.0; $b7 = 298.257222101; $b8 = 1 / $b7; $b9 = 2 * $b8 - $b8 * $b8; $b10 = sqrt($b9); $b13 = 3.0; $b14 = 700000.0; $b15 = 12655612.0499; $b16 = 0.725607765053267; $b17 = 11754255.426096; $delx = $x - $b14; $dely = $y - $b15; $gamma = atan(-$delx / $dely); $r = sqrt($delx * $delx + $dely * $dely); $latiso = log($b17 / $r) / $b16; $sinphiit0 = tanh($latiso + $b10 * atanh($b10 * sin(1))); $sinphiit1 = tanh($latiso + $b10 * atanh($b10 * $sinphiit0)); $sinphiit2 = tanh($latiso + $b10 * atanh($b10 * $sinphiit1)); $sinphiit3 = tanh($latiso + $b10 * atanh($b10 * $sinphiit2)); $sinphiit4 = tanh($latiso + $b10 * atanh($b10 * $sinphiit3)); $sinphiit5 = tanh($latiso + $b10 * atanh($b10 * $sinphiit4)); $sinphiit6 = tanh($latiso + $b10 * atanh($b10 * $sinphiit5)); $longrad = $gamma / $b16 + $b13 / 180 * pi(); $latrad = asin($sinphiit6); $long = $longrad / pi() * 180; $lat = $latrad / pi() * 180; return array('y84' => $lat, 'x84' => $long); }
function lat2y($lat, $pixels = 32768) { return (atanh(sin(deg2rad(-$lat))) / M_PI + 1) * ($pixels / 2); }
<?php define("MAX_64Bit", 9223372036854775807); define("MAX_32Bit", 2147483647); define("MIN_64Bit", -9223372036854775807 - 1); define("MIN_32Bit", -2147483647 - 1); $longVals = array(MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, MAX_32Bit * 2 + 1, MAX_32Bit * 2 - 1, MAX_64Bit - 1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1); foreach ($longVals as $longVal) { echo "--- testing: {$longVal} ---\n"; var_dump(atanh($longVal)); } ?> ===DONE===
public static function atanh($self, $a) { return atanh($a); }
/** * @param int|float $number * * @return float */ function inverseHyperbolicTangent($number) { return (double) \atanh($number); }
echo ltrim("\t\tThese are a few words :) ... "); echo ltrim("\t\tThese are a few words :) ... ", " \t."); echo ltrim("\tExample string\n", ".."); echo rtrim("\t\tThese are a few words :) ... "); echo rtrim("\t\tThese are a few words :) ... ", " \t."); echo rtrim("\tExample string\n", ".."); echo chop("\t\tThese are a few words :) ... "); echo chop("\t\tThese are a few words :) ... ", " \t."); echo chop("\tExample string\n", ".."); echo acos(0.5); echo acosh(0.5); echo asin(0.5); echo asinh(0.5); echo atan(0.5); echo atan2(0.5, 0.5); echo atanh(0.5); echo cos(0.5); echo cosh(0.5); echo sin(0.5); echo sinh(0.5); echo tan(0.5); echo tanh(0.5); echo exp(5.7); echo exp(12); echo log10(12); echo log(12); echo sqrt(2); echo ceil(7.9); echo floor(7.9); echo fmod(5.7, 1.3); echo ip2long("127.0.0.1");
<?php /* * proto float atanh(float number) * Function is implemented in ext/standard/math.c */ //Test atanh with a different input values $values = array(23, -23, 23.45, -23.45, 0x17, 027, "23", "23.45", "2.345e1", "nonsense", "1000", "1000ABC", null, true, false); for ($i = 0; $i < count($values); $i++) { $res = atanh($values[$i]); var_dump($res); }
/** * @param float $x A number * @return float The hyperbolic arctangent (in radians) of the given value */ public function atanh($x) { return atanh($x); }
private function _atanh($num) { $num = (double) $num; if (function_exists('atanh')) { return atanh($num); } if (1 == $num) { return NAN; } return 1 / 2 * log((1 + $num) / (1 - $num)); }
echo acos(-2354) . " " . acos("foo") . " " . acos(0) . " " . acos(5) . acos(1.2345) . "\n"; if (PHP_OS != 'WINNT') { echo "acosh\n"; echo acosh(-2354) . " " . acosh("foo") . " " . acosh(0) . " " . acosh(5) . acosh(1.2345) . "\n"; } echo "asin\n"; echo asin(-2354) . " " . asin("foo") . " " . asin(0) . " " . asin(5) . asin(1.2345) . "\n"; if (PHP_OS != 'WINNT') { echo "asinh\n"; echo asinh(-2354) . " " . asinh("foo") . " " . asinh(0) . " " . asinh(5) . asinh(1.2345) . "\n"; } echo "atan\n"; echo atan(-2354) . " " . atan("foo") . " " . atan(0) . " " . atan(5) . atan(1.2345) . "\n"; if (PHP_OS != 'WINNT') { echo "atanh\n"; echo atanh(-2354) . " " . atanh("foo") . " " . atanh(0) . " " . atanh(5) . atanh(1.2345) . "\n"; } echo "atan2\n"; echo atan2(-2354, 3) . " " . atan2("foo", 12) . " " . atan2(0, 3) . " " . atan2(5, 2.3) . atan2(1.2345, 3.22) . "\n"; echo "base_convert\n"; echo base_convert("-2354", 10, 2) . " " . base_convert("foo", 10, 10) . " " . base_convert(300, 4, 20) . " " . base_convert(5, 6, 7) . " " . base_convert(5, 4, 7) . " " . base_convert(1.2345, 8, 2) . "\n"; echo "bindec\n"; echo bindec("-2354") . " " . bindec("foo") . " " . bindec(0) . " " . bindec(5) . bindec("1.2345") . "\n"; echo "ceil\n"; echo ceil(-2354) . " " . ceil("foo") . " " . ceil(0) . " " . ceil(5) . ceil(1.2345) . "\n"; echo "cos\n"; echo cos(-2354) . " " . cos("foo") . " " . cos(0) . " " . cos(5) . cos(1.2345) . "\n"; echo "cosh\n"; echo cosh(-2354) . " " . cosh("foo") . " " . cosh(0) . " " . cosh(5) . cosh(1.2345) . "\n"; echo "decbin\n"; echo decbin(2354) . " " . decbin("foo") . " " . decbin(0) . " " . decbin("5") . decbin(1.2345) . "\n";
/** * Evaluate a FunctionNode * * Computes the value of a FunctionNode `f(x)`, where f is * an elementary function recognized by StdMathLexer and StdMathParser. * * @see \MathParser\Lexer\StdMathLexer StdMathLexer * @see \MathParser\StdMathParser StdMathParser * @throws UnknownFunctionException if the function respresented by the * FunctionNode is *not* recognized. * * @param FunctionNode $node AST to be evaluated * @retval float */ public function visitFunctionNode(FunctionNode $node) { $inner = $node->getOperand()->accept($this); switch ($node->getName()) { // Trigonometric functions case 'sin': return sin($inner); case 'cos': return cos($inner); case 'tan': return tan($inner); case 'cot': return 1 / tan($inner); // Trigonometric functions, argument in degrees // Trigonometric functions, argument in degrees case 'sind': return sin(deg2rad($inner)); case 'cosd': return cos(deg2rad($inner)); case 'tand': return tan(deg2rad($inner)); case 'cotd': return 1 / tan(deg2rad($inner)); // Inverse trigonometric functions // Inverse trigonometric functions case 'arcsin': return asin($inner); case 'arccos': return acos($inner); case 'arctan': return atan($inner); case 'arccot': return pi() / 2 - atan($inner); // Exponentials and logarithms // Exponentials and logarithms case 'exp': return exp($inner); case 'log': return log($inner); case 'lg': return log10($inner); // Powers // Powers case 'sqrt': return sqrt($inner); // Hyperbolic functions // Hyperbolic functions case 'sinh': return sinh($inner); case 'cosh': return cosh($inner); case 'tanh': return tanh($inner); case 'coth': return 1 / tanh($inner); // Inverse hyperbolic functions // Inverse hyperbolic functions case 'arsinh': return asinh($inner); case 'arcosh': return acosh($inner); case 'artanh': return atanh($inner); case 'arcoth': return atanh(1 / $inner); case 'abs': return abs($inner); case 'sgn': return $inner >= 0 ? 1 : 0; case '!': $logGamma = Math::logGamma(1 + $inner); return exp($logGamma); case '!!': if (round($inner) != $inner) { throw new \UnexpectedValueException("Expecting positive integer (semifactorial)"); } return Math::SemiFactorial($inner); default: throw new UnknownFunctionException($node->getName()); } }