Documentation

intmax

Largest value of specified integer type

Syntax

v = intmax
v = intmax('classname')

Description

v = intmaxis the largest positive value that can be represented in the MATLAB®software with a 32-bit integer. Any value larger than the value returned byintmaxsaturates to theintmaxvalue when cast to a 32-bit integer.

v = intmax('classname')is the largest positive value in the integer classclassname. Valid values for the stringclassnameare

'int8'

'int16'

'int32'

'int64'

“uint8”

'uint16'

'uint32'

'uint64'

intmax('int32')is the same asintmaxwith no arguments.

Examples

Find the maximum value for a 64-bit signed integer:

v = intmax('int64') v = 9223372036854775807

Convert this value to a 32-bit signed integer:

x = int32(v) x = 2147483647

Compare the result with the default value returned byintmax:

isequal(x, intmax) ans = 1

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a

Was this topic helpful?