Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Math.cosh()

This is a new technology, part of the ECMAScript 2015 (ES6) standard.
This technology's specification has been finalized, but check the compatibility table for usage and implementation status in various browsers.

La funció Math.cosh() retorna el cosinus hiperbòlic d'un nombre, això es pot expressar utilitzant la constant e:

Math.cosh(x)=ex+e-x2\mathtt{\operatorname{Math.cosh(x)}} = \frac{e^x + e^{-x}}{2}

Sintaxi

Math.cosh(x)

Paràmetres

x
Un nombre.

Descripció

Com que que cosh() és un mètode estàtic de Math, sempre s'utilitza com a Math.cosh(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

Exemples

Utilitzar Math.cosh()

Math.cosh(0);  // 1
Math.cosh(1);  // 1.5430806348152437
Math.cosh(-1); // 1.5430806348152437

Polyfill

Aquesta funció es pot emular amb l'ajuda de la funció Math.exp():

Math.cosh = Math.cosh || function(x) {
  return (Math.exp(x) + Math.exp(-x)) / 2;
}

o bé utilitzant només una crida a la funció Math.exp():

Math.cosh = Math.cosh || function(x) {
  var y = Math.exp(x);
  return (y + 1 / y) / 2;
};

Especificacions

Especificació Estat Comentaris
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Math.cosh' in that specification.
Standard Definició inicial.

Compatibilitat amb navegadors

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic 38 25 (25) Not supported 25 7.1
Característica Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic Not supported Not supported 25.0 (25) Not supported Not supported 8

Vegeu també

Document Tags and Contributors

 Contributors to this page: enTropy
 Last updated by: enTropy,