Math.asinh()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

La función Math.asinh() retorna el arcoseno hyperbólico de un número, es decir

Math.asinh(x)=arsinh(x)= the unique ysuch thatsinh(y)=x\mathtt{\operatorname{Math.asinh}(x)} = \operatorname{arsinh}(x) = \text{ the unique } ; y ; \text{such that} ; \sinh(y) = x

Sintáxis

js
Math.asinh(x);

Parámetros

x

Un número.

Valor de retorno

El arcoseno hyperbólico del número dado.

Descripción

Debido a que asinh() es un método estático de Math, siempre hay que usarlo como Math.asinh(), en lugar de como un método del objeto Math que se hayamos creado (Math no es un constructor).

Ejemplos

Usos de Math.asinh()

js
Math.asinh(1); // 0.881373587019543
Math.asinh(0); // 0

Polyfill

As a quick and dirty hack the expression arsinh(x)=ln(x+x2+1)\operatorname {arsinh} (x) = \ln \left(x + \sqrt{x^{2} + 1} \right) may be used directly for a coarse emulation by the following function:

js
Math.asinh =
  Math.asinh ||
  function (x) {
    if (x === -Infinity) {
      return x;
    } else {
      return Math.log(x + Math.sqrt(x * x + 1));
    }
  };

Been formally correct it suffers from a number of issues related to floating point computations. Accurate result requires special handling of positive/negative, small/large arguments as it done e.g. in glibc or GNU Scientific Library.

Especificaciones

Specification
ECMAScript Language Specification
# sec-math.asinh

Compatibilidad con navegadores

BCD tables only load in the browser

See also