intmax - Largest value of specific integer type - MATLAB (original) (raw)

Main Content

Largest value of specific integer type

Syntax

Description

[v](#mw%5F5488ce8e-5cb3-40e1-b7f7-7625ce381849) = intmax returns the largest value of the 32-bit signed integer type.

example

[v](#mw%5F5488ce8e-5cb3-40e1-b7f7-7625ce381849) = intmax([type](#mw%5F73a4b0c3-bbd2-4e4a-9553-27d209228077)) returns the largest value of the specified integer type. When you convert a value that is larger than intmax(type) into the integer type type, the value becomes intmax(type).

example

[v](#mw%5F5488ce8e-5cb3-40e1-b7f7-7625ce381849) = intmax(like=[p](#mw%5F445778e0-3114-4d9a-a399-f1fa7be1c074)) returns the largest value of the integer type with the same data type and complexity (real or complex) as the integer variable p.

example

Examples

collapse all

Return the largest value of the 32-bit signed integer type.

Return the largest value of the 64-bit unsigned integer type.

v = uint64

18446744073709551615

Check the class of v.

Return the largest value of the 8-bit signed integer type, which is 127.

Convert a value larger than 127 to 8-bit signed integer.

The converted value becomes 127.

Check that v1 is the same as v.

Create a 2-by-3 complex array of 8-bit signed integers.

p = int8([-12 3+2i 2; 6 3 2-7i]);

Return the largest value of the integer type with the same data type and complexity as p.

Input Arguments

collapse all

Integer type, specified as a character vector or string. This table shows the valid options for type.

Integer Type Description
"int8" 8-bit signed integer
"int16" 16-bit signed integer
"int32" 32-bit signed integer
"int64" 64-bit signed integer
"uint8" 8-bit unsigned integer
"uint16" 16-bit unsigned integer
"uint32" 32-bit unsigned integer
"uint64" 64-bit unsigned integer

Prototype, specified as an integer variable.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

Output Arguments

collapse all

Largest value of the specified integer type, returned as a scalar.

Extended Capabilities

expand all

This function supports tall arrays with the limitations:

For more information, see Tall Arrays.

The intmax function supports GPU array input with these usage notes and limitations:

For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Usage notes and limitations:

For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).

Version History

Introduced before R2006a