Main Content

intmin

Smallest value of specific integer type

Description

example

v = intmin returns the smallest value of the 32-bit signed integer type.

example

v = intmin(type) returns the smallest value of the specified integer type. When you convert a value that is smaller than intmin(type) into the integer type type, the value becomes intmin(type).

example

v = intmin("like",p) returns the smallest value of the integer type with the same data type and complexity (real or complex) as the integer variable p.

Examples

collapse all

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

v = intmin
v = int32
    -2147483648

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

v = intmin("uint64")
v = uint64
    0

Check the class of v.

class(v)
ans = 
'uint64'

Return the smallest value of the 8-bit signed integer type, which is –128.

v = intmin("int8")
v = int8
    -128

Convert a value smaller than –128 to 8-bit signed integer.

v1 = int8(-135)
v1 = int8
    -128

The converted value becomes –128.

Check that v1 is the same as v.

isequal(v,v1)
ans = logical
   1

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

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

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

v = intmin("like",p)
v = int8
    -128 + 0i
class(v)
ans = 
'int8'

Input Arguments

collapse all

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

Integer TypeDescription

"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

Extended Capabilities

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

Version History

Introduced before R2006a