Single Data Type (Visual Basic)
Updated: July 20, 2015
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Holds signed IEEE 32-bit (4-byte) single-precision floating-point numbers ranging in value from -3.4028235E+38 through -1.401298E-45 for negative values and from 1.401298E-45 through 3.4028235E+38 for positive values. Single-precision numbers store an approximation of a real number.
Single data type to contain floating-point values that do not require the full data width of
Double. In some cases the common language runtime might be able to pack your
Single variables closely together and save memory consumption.
The default value of
Single is 0.
Precision. When you work with floating-point numbers, keep in mind that they do not always have a precise representation in memory. This could lead to unexpected results from certain operations, such as value comparison and the
Modoperator. For more information, see Troubleshooting Data Types.
Singledata type widens to
Double. This means you can convert
Doublewithout encountering a System.OverflowException error.
Trailing Zeros. The floating-point data types do not have any internal representation of trailing 0 characters. For example, they do not distinguish between 4.2000 and 4.2. Consequently, trailing 0 characters do not appear when you display or print floating-point values.
Type Characters. Appending the literal type character
Fto a literal forces it to the
Singledata type. Appending the identifier type character
!to any identifier forces it to
Framework Type. The corresponding type in the .NET Framework is the System.Single structure.