C# Numeric Type Information

I was surprised I couldn’t find a summary of numeric type information readily available on the web. So I created this one.

C# Type Range Precision .NET Framework Type Notes
double ±5.0 × 10−324 to ±1.7 × 10308 15-16 digits System.Double 64-bit floating-point values
float ±3.4 × 1038 7 digits System.Single 32-bit floating-point values
decimal (-7.9 x 1028 to 7.9 x 1028) / (100 to 28) 28-29 significant digits System.Decimal more precision/smaller range than floating-point; appropriate for financial/monetary calculations
Integral Types Range Size .NET Framework Type Notes
sbyte -128 to 127 Signed 8-bit integer System.Sbyte
byte 0 to 255 Unsigned 8-bit integer System.Byte
char U+0000 to U+ffff Unicode 16-bit character System.Char
short -32,768 to 32,767 Signed 16-bit integer System.Int16
ushort 0 to 65,535 Unsigned 16-bit integer System.UInt16
int -2,147,483,648 to 2,147,483,647 Signed 32-bit integer ~ ±2.1 x 109
uint 0 to 4,294,967,295 Unsigned 32-bit integer System.UInt32
long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Signed 64-bit integer System.Int64 ~ ±9.2 x 1018
ulong 0 to 18,446,744,073,709,551,615 Unsigned 64-bit integer System.UInt64 ~ ±1.8 x 1019
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s