四捨五入

'------------------------------------------------------------------------
'概 要:四捨五入
'引 数:dblValue 四捨五入対象
' intiti 四捨五入する位置
' -2 ⇒ 2桁目で四捨五入
' -1 ⇒ 1桁目で四捨五入
' 0 ⇒ 少数第一位で四捨五入
' 1 ⇒ 少数第二位で四捨五入
' 2 ⇒ 少数第三位で四捨五入
'戻り値:四捨五入された数値
'------------------------------------------------------------------------
Public Function Round(ByVal dblValue As Double, ByVal intIti As Integer) As Double

Dim dblShift As Double

dblShift = System.Math.Pow(10, intIti)

If dblValue > 0 Then
Return System.Math.Floor ((dblValue * dblShift) + 0.5) / dblShift
Else
Return System.Math.Ceiling((dblValue * dblShift) - 0.5) / dblShift
End If

End Function