Eの引数乗 (Ex) を返します.
Math.exp(x)
expメソッドはネイピア数Eのx乗 (Ex) を返します.
以下にexpメソッドを使用したサンプルコードを示します.
<html>
<head>
<title>expメソッドのサンプルコード</title>
</head>
<body>
<script type="text/javascript" language="javascript">
document.write(Math.exp(2) + "<br />");
document.write(Math.exp(1) + "<br />");
document.write(Math.exp(0) + "<br />");
document.write(Math.exp(-1) + "<br />");
document.write(Math.exp(-2) + "<br />");
</script>
</body>
</html>
サンプルコードの実行結果は以下のようになります.
7.38905609893065 2.718281828459045 1 0.36787944117144233 0.1353352832366127
スポンサード リンク