roundToNearest()

概要

round()は数値 n を i の最も近い増分に丸めるために使用します。指定された数値が 2 つの増分から等しく離れている場合、この関数は最も近い偶数の増分に丸めます。

構文

roundToNearest ( n As Number, _
                 i As Number ) As Number 
引数 [タイプ] 説明
n [数] 入力数値です。
i [数] 概数で表すための増分です。

例 1

Intent >roundToNearest(5.73, 0.25) 
--> 5.75 

例 2

Intent >roundToNearest(-0.37, 0.1) 
--> -0.4 

例 3

Intent >roundToNearest(376.9, 10) 
--> 380.0 

例 4

Intent >roundToNearest(385, 10) 
--> 380.0 
390.0 を返す roundInc(385, 10)と比較します