Sprache: VB
Gibt den Wert zurück nach ohne ganze Zahlen ist.
Public Function GetDecimals(ByVal V As Single) As Single
Dim i As Integer = Global.System.Math.Truncate(V)
Return V - i
End Function
Public Function GetDecimals(ByVal V As Double) As Double
Dim i As Integer = Global.System.Math.Truncate(V)
Return V - i
End Function
Public Function GetDecimals(ByVal V As Single) As Single
Dim i As Integer = Global.System.Math.Truncate(V)
Return V - i
End Function
Public Function GetDecimals(ByVal V As Double) As Double
Dim i As Integer = Global.System.Math.Truncate(V)
Return V - i
End Function
Alte URL:
/snippet/nachkommastellen-wert-erfahren/957
Man kann das eigentlich noch kürzer schreiben. Wozu die Variable I definieren?
[code]
Public Function GetDecimals(ByVal V As Double) As Double
Return V – Global.System.Math.Truncate(V)
End Function
[/code]