Difference between revisions of "CSharp Numeric Limits"

From Logic Wiki
Jump to: navigation, search
(Created page with "== Integer Data Types == {| class="wikitable" border="1" |- ! Type ! Description ! Minimum ! Maximum ! Bits |- ! bool | Boolean flag | false | true | 1 |- ! byte | Unsign...")
 
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
 
|-
 
|-
 
! bool
 
! bool
| Boolean flag
+
| style="background-color:white;" | Boolean flag
| false
+
| style="background-color:white;" | false
| true
+
| style="background-color:white;" | true
| 1
+
| style="background-color:white;" | 1
 
|-
 
|-
 
! byte
 
! byte
| Unsigned Byte
+
| style="background-color:white;" | Unsigned Byte
|0
+
| style="background-color:white;" |0
| 255
+
| style="background-color:white;" | 255
|8
+
| style="background-color:white;" |8
 
|-
 
|-
 
! sbyte
 
! sbyte
|Signed Byte
+
| style="background-color:white;" |Signed Byte
| -128
+
| style="background-color:white;" | -128
|  127
+
| style="background-color:white;" |  127
|8
+
| style="background-color:white;" |8
 
|-
 
|-
 
! short
 
! short
|Signed Short Integer
+
| style="background-color:white;" |Signed Short Integer
|  -32,768
+
| style="background-color:white;" |  -32,768
| 32,767   
+
| style="background-color:white;" | 32,767   
| 16
+
| style="background-color:white;" | 16
 
|-
 
|-
 
! ushort
 
! ushort
| Unsigned Short Integer
+
| style="background-color:white;" | Unsigned Short Integer
| 0
+
| style="background-color:white;" | 0
| 65,535   
+
| style="background-color:white;" | 65,535   
| 16
+
| style="background-color:white;" | 16
 
|-
 
|-
 
! int
 
! int
|Signed Integer
+
| style="background-color:white;" |Signed Integer
| -2,147,483,648   
+
| style="background-color:white;" | -2,147,483,648   
| 2,147,483,647  
+
| style="background-color:white;" | 2,147,483,647  
| 32
+
| style="background-color:white;" | 32
 
|-
 
|-
 
! uint
 
! uint
| Unsigned Integer
+
| style="background-color:white;" | Unsigned Integer
| 0
+
| style="background-color:white;" | 0
| 4,294,967,295  
+
| style="background-color:white;" | 4,294,967,295  
| 32
+
| style="background-color:white;" | 32
 
|-
 
|-
 
! long
 
! long
| Signed Long Integer
+
| style="background-color:white;" | Signed Long Integer
| -9x10 <sup>18</sup>
+
| style="background-color:white;" | -9x10 <sup>18</sup>
|9x10 <sup>18</sup>
+
| style="background-color:white;" |9x10 <sup>18</sup>
|64
+
| style="background-color:white;" |64
 
|-
 
|-
 
! ulong
 
! ulong
|Unsigned Long Integer
+
| style="background-color:white;" |Unsigned Long Integer
| 0
+
| style="background-color:white;" | 0
|1.8x10<sup>19</sup>  
+
| style="background-color:white;" |1.8x10<sup>19</sup>  
| 64
+
| style="background-color:white;" | 64
 
|}
 
|}
  
Line 73: Line 73:
 
|-
 
|-
 
! float
 
! float
| Single Precision Number
+
| style="background-color:white;" | Single Precision Number
| ±1.5x10<sup>45</sup> to ±3.4x10<sup>38</sup>
+
| style="background-color:white;" | ±1.5x10<sup>45</sup> to ±3.4x10<sup>38</sup>
| 7 digits
+
| style="background-color:white;" | 7 digits
| 32
+
| style="background-color:white;" | 32
 
|-
 
|-
 
! double  
 
! double  
| Double Precision Number
+
| style="background-color:white;" | Double Precision Number
| ±5x10<sup>324</sup> to ±1.7x10<sup>308</sup>
+
| style="background-color:white;" | ±5x10<sup>324</sup> to ±1.7x10<sup>308</sup>
| 15 or 16 digits
+
| style="background-color:white;" | 15 or 16 digits
| 64
+
| style="background-color:white;" | 64
 
|-
 
|-
 
! decimal
 
! decimal
| Decimal Number
+
| style="background-color:white;" | Decimal Number
| ±10<sup>28</sup> to ±7.9x10<sup>28</sup>
+
| style="background-color:white;" | ±10<sup>28</sup> to ±7.9x10<sup>28</sup>
| 18 or 29 digits
+
| style="background-color:white;" | 18 or 29 digits
| 128
+
| style="background-color:white;" | 128
 
|}
 
|}

Latest revision as of 14:41, 20 June 2017

Integer Data Types

Type Description Minimum Maximum Bits
bool Boolean flag false true 1
byte Unsigned Byte 0 255 8
sbyte Signed Byte -128 127 8
short Signed Short Integer -32,768 32,767 16
ushort Unsigned Short Integer 0 65,535 16
int Signed Integer -2,147,483,648 2,147,483,647 32
uint Unsigned Integer 0 4,294,967,295 32
long Signed Long Integer -9x10 18 9x10 18 64
ulong Unsigned Long Integer 0 1.8x1019 64

Non-Integer (Floating Point) Data Types

Type Description Scale Precision Bits
float Single Precision Number ±1.5x1045 to ±3.4x1038 7 digits 32
double Double Precision Number ±5x10324 to ±1.7x10308 15 or 16 digits 64
decimal Decimal Number ±1028 to ±7.9x1028 18 or 29 digits 128