Appendix B. Simple Types

Table B.1. Simple types.

Type

Size in bits

Value range

Standard

bool

8

true or false

 

byte

8

0 to 255, inclusive

 

sbyte

8

–128 to 127, inclusive

 

char

16

'u0000' to 'uFFFF' (0 to 65535), inclusive

Unicode

short

16

–32768 to 32767, inclusive

 

ushort

16

0 to 65535, inclusive

 

int

32

–2,147,483,648 to 2,147,483,647, inclusive

 

uint

32

0 to 4,294,967,295, inclusive

 

float

32

Approximate negative range:

–3.4028234663852886E+38 to –1.40129846432481707E–45

Approximate positive range:

1.40129846432481707E–45 to 3.4028234663852886E+38

Other supported values:

positive and negative zero

positive and negative infinity

not-a-number (NaN)

IEEE 754

IEC 60559

long

64

–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, inclusive

 

ulong

64

0 to 18,446,744,073,709,551,615, inclusive

 

double

64

Approximate negative range:

–1.7976931348623157E+308 to –4.94065645841246544E–324

Approximate positive range:

4.94065645841246544E–324 to 1.7976931348623157E+308

Other supported values:

positive and negative zero

positive and negative infinity

not-a-number (NaN)

IEEE 754

IEC 60559

decimal

128

Negative range:

79,228,162,514,264,337,593,543,950,335

(–7.9E+28) to 1.0E–28

Positive range:

1.0E–28 to 79,228,162,514,264,337,593,543,950,335

(7.9E+28)

 

Additional Simple Type Information

  • This appendix is based on information from Sections 4.1.4–4.1.8 of Microsoft’s version of the C# Language Specification and Sections 11.1.4–11.1.8 of the ECMA-334 (the ECMA version of the C# Language Specification). These documents are available from the following websites:

    msdn.microsoft.com/en-us/vcsharp/aa336809.aspx
    www.ecma-international.org/publications/standards/Ecma-334.htm
  • Values of type float have seven digits of precision.

  • Values of type double have 15–16 digits of precision.

  • Values of type decimal are represented as integer values that are scaled by a power of 10. Values between −1.0 and 1.0 are represented exactly to 28 digits.

  • For more information on IEEE 754 visit grouper.ieee.org/groups/754/. For more information on Unicode, see Appendix F.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.152.58