Working with numbers
One of the most common types of data is numbers. The most common types in .NET for working with numbers are shown in Table 8.1:
Namespace | Example types | Description |
System |
SByte , Int16 , Int32 , Int64 , Int128 |
Integers; that is, zero, and positive and negative whole numbers. |
System |
Byte , UInt16 , UInt32 , UInt64 , UInt128 |
Cardinals; that is, zero and positive whole numbers. |
System |
Half , Single , Double |
Reals; that is, floating-point numbers. |
System |
Decimal |
Accurate reals; that is, for use in science, engineering, or financial scenarios. |
System.Numerics |
BigInteger , Complex , Quaternion |
Arbitrarily large integers, complex numbers, and quaternion numbers. |
.NET has had the 32-bit float
and 64-bit double
types since .NET Framework 1.0 was released in 2002. The IEEE 754 specification also defines a 16-bit floating-point standard. Machine learning and other algorithms would benefit from this smaller, lower-precision...