Data type
The data type of numerical (integer) literals between -2147483648 and 2147483647 is a 32-bit signed integer.
Outside of that range, but within -9223372036854775808 and 9223372036854775807, the data type is a 64-bit signed integer.
Outside of that range, but within -79,228,162,514,264,337,593,543,950,335 and 79,228,162,514,264,337,593,543,950,335 the data type is
System.Decimal
.
An integer literal allows to specify its data type with one of the following suffixes. Most of those suffixes were added only with PowerShell version 6.2, though
Suffix | Type |
y , uy | System.SByte , System.Byte |
s , us | System.Int16 , System.UInt16 |
l , ul | System.Int64 , System.UInt64 |
u | System.Int32 |
n | System.Numerics.BigInteger |
Hexadecimal notation
An integer can be represented with the hexadecimal notation by prefixing the hexadecimal value with 0x
:
PS C:\> 0x10 * 0x0f
240
Literals written with the hexadecimal notation are interpreted as signed 32-bit integer:
PS C:\> 0x7fffffff
2147483647
PS C:\> 0x80000000
-2147483648