int8
conversão para representação de inteiro de 1 byte
int16
conversão para representação de inteiro de 2 bytes
int32
conversão para representação de inteiro de 4 bytes
int64
conversão para representação de inteiro de 8 bytes
uint8
conversão para representação de inteiro de 1 byte sem sinal
uint16
conversão para representação de inteiro de 2 bytes sem sinal
uint32
conversão para representação de inteiro de 4 bytes sem sinal
uint32
conversão para representação de inteiro de 8 bytes sem sinal
Seqüência de Chamamento
y = int8(X) y = int16(X) y = int32(X) y = int64(X) y = uint8(X) y = uint16(X) y = uint32(X) y = uint64(X)
Parâmetros
- X
- matriz de booleanos, de inteiros codificados, ou de números reais ou complexos decimais. 
- y
                    matriz de inteiros codificados em 1, 2, 4 ou 8 bytes. Seus tamanhos são os de X. 
Descrição
Converte e armazena dados em interos de 1, 2 ou 4 bytes. Estes tipos de dados são especialmente úteis para armazenar objetos grandes como imagens, sinais longos,...
|  | If some  int8([-3.6, -2.5, -1.4, 1.3, 3.5, 6.7]) // = [-3, -2, -1, 1, 3, 6].Values of  
 -%inf is always converted into the lower bound of the interval (see below). %inf is always converted into the upper bound of the interval (see below). %nan is always converted into 0. If  [%f %t] is always converted into [0 1]. Converting big int64 or uint64 integers into decimal numbers may change them and downgrade their relative accuracy. Indeed, int64|uint64 integers are encoded over 63|64 bits, while the mantissa of decimal numbers is encoded over 53 bits only. For more details, please refer to the double() page. | 
|  | Converting  []always keeps it as is, of type 1 (decimal type). | 
| Function | y in | = | 
|---|---|---|
| int8(X) | [- 27, 27-1] | [-128, 127] | 
| int16(X) | [- 215, 215-1] | [-32768, 32767] | 
| int32(X) | [- 231, 231-1] | [-2147483648, 2147483647] | 
| int64(X) | [- 263, 263-1] | [-9223372036854775808, 9223372036854775807] | 
| uint8(X) | [0, 28-1] | [0, 255] | 
| uint16(X) | [0, 216-1] | [0, 65535] | 
| uint32(X) | [0, 232-1] | [0, 4294967295] | 
| uint64(X) | [0, 264-1] | [0, 18446744073709551615] | 
Exemplos
Rounding to 0 and wrapping, and special values:
int8([-11.7 -8.5 -6.4 6.4 8.5 11.7]) int8([-130 -129 -128 -127 126 127 128 129]) a = -129 + 256*(-3:3) int8(a) int8([-%inf %inf %nan])
--> int8([-11.7 -8.5 -6.4 6.4 8.5 11.7]) ans = -11 -8 -6 6 8 11 --> int8([-130 -129 -128 -127 126 127 128 129]) ans = 126 127 -128 -127 126 127 -128 -127 --> a = -129 + 256*(-3:3) a = -897. -641. -385. -129. 127. 383. 639. --> int8(a) ans = 127 127 127 127 127 127 127 --> int8([-%inf %inf %nan]) ans = -128 127 0
About wrapping and upper bounds of unsigned integers:
--> uint8([-1 %inf]) ans = 255 255 --> uint16([-1 %inf]) ans = 65535 65535 --> uint32([-1 %inf]) ans = 4294967295 4294967295 --> uint64([-1 %inf]) ans = 18446744073709551615 18446744073709551615
Converting 64-bits integers into decimal numbers downgrades their accuracy:
--> i = uint64(2)^63 - 600 i = 9223372036854775208 --> i - uint64(double(i)) ans = 424
Converting booleans and complex numbers:
--> int8([%f %t]) ans = 0 1 --> int8(-10.2 + 3.4*%i) ans = -10 --> uint8(-10.2 + 3.4*%i) ans = 246
[] is not convertible:
--> i = uint16(3);
--> i(1,2) = 5.6
 i  =
  3  5
--> typeof(i)
 ans  =
 uint16
--> i = uint16([])
 i  =
    []
--> i(1,2) = 2.3
 i  =
   0.   2.3
--> typeof(i)
 ans  =
 constant
Ver Também
Histórico
| Version | Description | |||||||||||||||||||||
| 6.0 | 
 | 
| Report an issue | ||
| << iconvert | Inteiros | inttype >> |