Mots clés : .netfloating-pointdoubledecimal
92
10001.10010110011
12345.65789
88
float flt = 1F/3; double dbl = 1D/3; decimal dcm = 1M/3; Console.WriteLine("float: {0} double: {1} decimal: {2}", flt, dbl, dcm);
float: 0.3333333 double: 0.333333333333333 decimal: 0.3333333333333333333333333333
73
+---------+----------------+---------+----------+---------------------------------------------------------+ | C# | .Net Framework | Signed? | Bytes | Possible Values | | Type | (System) type | | Occupied | | +---------+----------------+---------+----------+---------------------------------------------------------+ | sbyte | System.Sbyte | Yes | 1 | -128 to 127 | | short | System.Int16 | Yes | 2 | -32,768 to 32,767 | | int | System.Int32 | Yes | 4 | -2,147,483,648 to 2,147,483,647 | | long | System.Int64 | Yes | 8 | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | | byte | System.Byte | No | 1 | 0 to 255 | | ushort | System.Uint16 | No | 2 | 0 to 65,535 | | uint | System.UInt32 | No | 4 | 0 to 4,294,967,295 | | ulong | System.Uint64 | No | 8 | 0 to 18,446,744,073,709,551,615 | | float | System.Single | Yes | 4 | Approximately ±1.5e-45 to ±3.4e38 | | | | | | with ~6-9 significant figures | | double | System.Double | Yes | 8 | Approximately ±5.0e-324 to ±1.7e308 | | | | | | with ~15-17 significant figures | | decimal | System.Decimal | Yes | 16 | Approximately ±1.0e-28 to ±7.9e28 | | | | | | with 28-29 significant figures | | char | System.Char | N/A | 2 | Any Unicode character (16 bit) | | bool | System.Boolean | N/A | 1 / 2 | true or false | +---------+----------------+---------+----------+---------------------------------------------------------+