intmax
intmax
intmax是一个编程函数。
基本内容
Matlab中intmax简介
函数功能: 返回指定整数类型所能表示的最大值。
调用格式:
v = intmax
返回matlab中32位正整数所能表示的正的最大值。
v = intmax('classname')
返回指定的整数类型所能表示的正的最大值。'classname'可以是:
'int8'、'int16'、'int32'、'int64'、'uint8'、'uint16'、'uint32'、'uint64'。
相关函数:intmin
程序示例
close all; clear; clc;
type_cell{1} = 'int';
type_cell{2} = 'uint';
bits = [8, 16, 32, 64];
for m = 1:2
for k = 1:4
type_str = strcat(type_cell{m}, num2str(bits(k)));
fprintf('The largest positive number ''%s'' can store is %s\n', ...