Skip to main content

CSng()

This function will change a number into a single type.  A single type has 4 decimals so any decimals larger than 4 will be rounded to 4.

Script

Sub Main
    Dim aDbl1, aDbl2 As Double
    Dim aSng1, aSng2 As Single
    aDbl1 = 24.5456985
    aDbl2 = 24.5456454
    MsgBox CSng(aDbl1) 'returns 24.5457

    ' The following line of code sets aLng2 to 25428.
    MsgBox CSng(aDbl2) 'returns 25.5456
End Sub

IDEAScript Language