Math.sinh()
Math.sinh()
関数は、引数として与えた数の双曲線正弦 (ハイパーボリックサイン) を返します。これは定数 e を使用して次のように表すことができます。
試してみましょう
構文
Math.sinh(x)
引数
x
-
数値。
返値
指定された数値の双曲線正弦 (ハイパーボリックサイン) です。
解説
sinh()
は Math
の静的メソッドであるため、生成した Math
オブジェクトのメソッドとしてではなく、常に Math.sinh()
として使用するようにしてください (Math
はコンストラクターではありません)。
ポリフィル
これは Math.exp()
関数を使用して次のようにエミュレートできます。
Math.sinh = Math.sinh || function(x) {
return (Math.exp(x) - Math.exp(-x)) / 2;
}
または Math.exp()
関数を一度だけ呼び出すようにすると、次のようになります。
Math.sinh = Math.sinh || function(x) {
var y = Math.exp(x);
return (y - 1 / y) / 2;
}
例
Using Math.sinh() の使用
Math.sinh(0); // 0
Math.sinh(1); // 1.1752011936438014
仕様書
Specification |
---|
ECMAScript Language Specification # sec-math.sinh |
ブラウザーの互換性
BCD tables only load in the browser