Math.round

数値の四捨五入

構文

Math.round(x)

引数

x=数値

例文

<html>
<head>
<title>Math.round</title>
</head>

<body>

<!--数値の四捨五入のサンプル-->
<script type="text/javascript">
document.write('0.60の四捨五入値は'+Math.round(0.60)+"です<br>");
document.write('0.50の四捨五入値は'+Math.round(0.50)+"です<br>");
document.write('0.49の四捨五入値は'+Math.round(0.49)+"です<br>");
document.write('-4.40の四捨五入値は'+Math.round(-4.40)+"です<br>");
document.write('-4.60の四捨五入値は'+Math.round(-4.60));
</script>

</body>
</html>

関連記事

スポンサーリンク

rcp リモート・マシン間でファイルのコピーをする

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る