Primitive Types (F#)
This topic lists the fundamental primitive types that are used in the F# language. It also provides the corresponding .NET types and the minimum and maximum values for each type.
The following table summarizes the properties of the primitive F# types.
Type |
.NET type |
Description |
---|---|---|
bool |
Possible values are true and false. |
|
byte |
Values from 0 to 255. |
|
sbyte |
Values from -128 to 127. |
|
int16 |
Values from -32768 to 32767. |
|
uint16 |
Values from 0 to 65535. |
|
int |
Values from -2,147,483,648 to 2,147,483,647. |
|
uint32 |
Values from 0 to 4,294,967,295. |
|
int64 |
Values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. |
|
uint64 |
Values from 0 to 18,446,744,073,709,551,615. |
|
nativeint |
A native pointer as a signed integer. |
|
unativeint |
A native pointer as an unsigned integer. |
|
char |
Unicode character values. |
|
string |
Unicode text. |
|
decimal |
A floating point data type that has at least 28 significant digits. |
|
unit |
not applicable |
Indicates the absence of an actual value. The type has only one formal value, which is denoted (). The unit value, (), is often used as a placeholder where a value is needed but no real value is available or makes sense. |
void |
Indicates no type or value. |
|
float32, single |
A 32-bit floating point type. |
|
float, double |
A 64-bit floating point type. |
备注
You can perform computations with integers too big for the 64-bit integer type by using the bigint type. bigint is not considered a primitive type; it is an abbreviation for BigInteger.