Třída Math Zaoukrohlování Math.Round
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cislo As Double = 1257.3654532657
Dim zaokrouhleno As Double
For i = 9 To 0 Step -1
zaokrouhleno = Math.Round(cislo, i)
Debug.Print(zaokrouhleno)
Next
' vrátí
'1257,365453266
'1257,36545327
'1257,3654533
'1257,365453
'1257,36545
'1257,3655
'1257,365
'1257,37
'1257,4
'1257
End Sub
End Class
|