Numeric Types - CSharp Language Basics

CSharp examples for Language Basics:Number

Introduction

C# has the predefined numeric types shown in the following Table.

C# type                  System type    Suffix  Size      Range

Integral-signed
sbyte                    SByte                  8 bits    -2^7   to 2^7  -1
short                    Int16                  16 bits   -2^15 to 2^15-1
int                      Int32                  32 bits   -2^31 to 2^31-1
long                     Int64          L       64 bits   -2^63 to 2^63-1

Integral-unsigned

byte                     Byte                   8 bits    0 to 2^8  -1
ushort                   UInt16                 16 bits   0 to 2^16-1
uint                     UInt32         U       32 bits   0 to 2^32-1

ulong                    UInt64         UL      64 bits   0 to 2^64-1

Real
float                    Single         F       32 bits   +/- (~10^-45 to 10^38)

double                   Double         D       64 bits   +/- (~10^-324 to 10^308)

decimal                  Decimal        M       128 bits  +/- (~10^-28 to 10^28)

Related Tutorials