The TYPEMAX function returns the maximum allowed value for an IDL data type.
Examples
IDL> types = [1,2,3,4,5,6,9,12,13,14,15]
IDL> foreach type, types do help, typemax(type)
<Expression> BYTE = 255
<Expression> INT = 32767
<Expression> LONG = 2147483647
<Expression> FLOAT = 3.40282e+38
<Expression> DOUBLE = 1.7976931e+308
<Expression> COMPLEX = ( 3.40282e+38, 3.40282e+38)
<Expression> DCOMPLEX = ( 1.7976931e+308, 1.7976931e+308)
<Expression> UINT = 65535
<Expression> ULONG = 4294967295
<Expression> LONG64 = 9223372036854775807
<Expression> ULONG64 = 18446744073709551615
IDL> print, typemax(/long64)
9223372036854775807
Syntax
Result = TYPEMAX( Type /BYTE, /INT, /LONG, /FLOAT, /DOUBLE, /COMPLEX, /DCOMPLEX, /UINT, /ULONG, /LONG64, /ULONG64)
Return Value
The result is a scalar number of the same data type that contains the maximum value.
Arguments
Type
Set this optional argument to an integer giving the IDL type code. If this argument is not set then one of the type keywords must be set. Possible values are:
| Type |
Name |
Result |
| 1 |
Byte |
255 |
| 2 |
Short integer |
32767 |
| 3 |
Long integer |
2147483647 |
| 4 |
Float |
3.40282e+38 |
| 5 |
Double |
1.7976931e+308 |
| 6 |
Complex |
(3.40282e+38, 3.40282e+38)
|
| 9 |
Double complex |
(1.7976931e+308, 1.7976931e+308) |
| 12 |
Unsigned short integer |
65535 |
| 13 |
Unsigned long integer
|
4294967295 |
| 14 |
64-bit integer |
9223372036854775807 |
| 15 |
Unsigned 64-bit integer
|
18446744073709551615 |
Keywords
BYTE
Set this keyword to return the maximum value for a byte number. This is 255.
INT
Set this keyword to return the maximum value for a short integer. This is 32767.
LONG
Set this keyword to return the maximum value for a long integer. This is 2147483647.
FLOAT
Set this keyword to return the maximum value for a single-precision floating-point number. This is 3.40282e+38.
DOUBLE
Set this keyword to return the maximum value for a double-precision floating-point number. This is 1.7976931e+308.
COMPLEX
Set this keyword to return the maximum value for a single-precision complex number. This is complex(3.40282e+38, 3.40282e+38).
DCOMPLEX
Set this keyword to return the maximum value for a double-precision number. This is dcomplex(1.7976931e+308, 1.7976931e+308).
UINT
Set this keyword to return the maximum value for an unsigned short integer. This is 65535.
ULONG
Set this keyword to return the maximum value for an unsigned long integer. This is 4294967295.
LONG64
Set this keyword to return the maximum value for a 64-bit integer. This is 9223372036854775807.
ULONG64
Set this keyword to return the maximum value for an unsigned 64-bit integer. This is 18446744073709551615.
Version History
See Also
MACHAR, TYPEMIN