Data Types - Floating Point


Decimals / Floating Point

double (-1.797 E 308 to 1.797 E 308)Double Precision Floating Point, System.Double
8 bytes (64 bits)
17 significant digits
Abbreviation Suffix - d or D (R in VB.Net)
decimal (1 E -28 to 7.9 E 28)Exact Precision Floating Point, System.Decimal
16 bytes (128 bits)
29 significant digits
Abbreviation Suffix - m or M (D in VB.Net)
Currency in VBA
float / single (-3.402 E 38 to 3.4.02 E 38)Single Precision Floating Point, System.Single
4 bytes (32 bits)
8 significant digits
Abbreviation Suffix - f or F
double (-1.797 E 308 to 1.797 E 308)
Double Precision Floating Point, System.Double
8 bytes (64 bits)
17 significant digits
Abbreviation Suffix - d or D (R in VB.Net)
decimal (1 E -28 to 7.9 E 28)
Exact Precision Floating Point, System.Decimal
16 bytes (128 bits)
29 significant digits
Abbreviation Suffix - m or M (D in VB.Net)
Currency in VBA
float / single (-3.402 E 38 to 3.4.02 E 38)
Single Precision Floating Point, System.Single
4 bytes (32 bits)
8 significant digits
Abbreviation Suffix - f or F

Converting to Integers

When you convert from a floating point to an integer you must use an explicit conversion.
Any fractional part of the number is always truncated (there is no rounding).


If you need rounding then you can use System.Convert






Division by zero results in infinity for floating point types




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