A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh below:

Math.acosh() - JavaScript | MDN

Math.acosh()

Baseline Widely available

La fonction Math.acosh() renvoie l'arc cosinus hyperbolique d'un nombre.Elle est définie par :

∀ x ≥ 1 , Math.acosh ( x ) = arcosh ( x ) = l'unique y ≥ 0 tel que cosh ( y ) = x \forall x \geq 1, \mathtt{\operatorname{Math.acosh}(x)} = \operatorname{arcosh}(x) = \text{ the unique } ; y \geq 0 ; \text{such that} ; \cosh(y) = x Exemple interactif
console.log(Math.acosh(0.999999999999));
// Expected output: NaN

console.log(Math.acosh(1));
// Expected output: 0

console.log(Math.acosh(2));
// Expected output: 1.3169578969248166

console.log(Math.acosh(2.5));
// Expected output: 1.566799236972411
Syntaxe Paramètres Valeur de retour

L'arc cosinus hyperbolique du nombre en argument. Si le nombre est inférieur à 1, la valeur renvoyée sera NaN.

Description

acosh étant une méthode statique de Math, il faut l'utiliser avec Math.acosh(), plutôt qu'en faisant appel à une méthode d'un autre objet créé (Math n'est pas un constructeur).

Exemple Utiliser Math.acosh()
Math.acosh(-1); // NaN
Math.acosh(0); // NaN
Math.acosh(0.5); // NaN
Math.acosh(1); // 0
Math.acosh(2); // 1.3169578969248166

Pour les valeurs strictement inférieures à 1 Math.acosh renvoie NaN.

Prothèse d'émulation (polyfill)

Pour tout x ≥ 1 x \geq 1 , arcosh ( x ) = ln ( x + x2 - 1 ) \operatorname {arcosh} (x) = \ln \left(x + \sqrt{x^{2} - 1} \right) , on peut donc émuler cette fonction avec le code suivant :

function acosh(x) {
  return Math.log(x + Math.sqrt(x * x - 1));
}
Spécifications Compatibilité des navigateurs Voir aussi

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4