Single

This is short for single precision floating point
The single data type can contain any numbers in the following ranges:
More info Numbers > Floating Point

Dim mySingle As Single 

This can support 7 significant figures with 6 decimal places.
You should always use the Double data type instead because this data type introduces rounding errors.


Negative numbers: -3.402823 E38 to -1.401298 E-45
Positive numbers: 1.401298 E-45 to 3.402823 E38
This data type uses 4 bytes
The default value is 0.


Public Sub RunSingle() 
Dim mySingle As Single
   mySingle = 1

   Do
      On Error GoTo ErrorHandler
      mySingle = mySingle * 2
      Debug.Print mySingle
   Loop

ErrorHandler:
   Stop
End Sub


© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext