Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - Русский

Change language to:
English - Français - 日本語 - Português -

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Справка Scilab >> Целые числа > iconvert

iconvert

преобразование в 1- или 8-байтное представление целого числа

Синтаксис

y = iconvert(X, itype)

Аргументы

X

матрица десятичных чисел или кодированных целых чисел. Комплексные числа не поддерживаются.

itype

целое число, тип преобразования.

y

матрица целых чисел, закодированных в 1, 2, 4 или 8 байтах.

Описание

Функция iconvert преобразует и хранит данные в виде 1-, 2-, 4- или 8-байтных целых чисел. Please refer to the int8() page for a detailled description.

itypey typeof range
0 (reals)
1 int8 [-128, 127]
2 int16 [-32768, 32767]
4 int32 [-2147483648, 2147483647]
8 int64 [-9223372036854775808, 9223372036854775807]
11 uint8 [0, 255]
12 uint16 [0, 65535]
14 uint32 [0, 4294967295]
18 uint64 [0, 18446744073709551615]

Примеры

b = int32([1 -120 127 312])
y = iconvert(b,1)

typeof(b)
typeof(y)

iconvert([-3.6 -2.5 -1.2 1.2 2.5 3.6], 1)
iconvert([-%inf %inf %nan], 1)
iconvert([-%inf %inf %nan], 11)
iconvert(-1, 11)
iconvert(-1, 12)
iconvert(-1, 14)
iconvert(-1, 18)
--> iconvert([-3.6 -2.5 -1.2 1.2 2.5 3.6], 1)
 ans  =
 -3 -2 -1  1  2  3

--> iconvert([-%inf %inf %nan], 1)
 ans  =
 -128  127  0

--> iconvert([-%inf %inf %nan], 11)
 ans  =
  0  255  0

--> iconvert(-1, 11)
 ans  =
  255

--> iconvert(-1, 12)
 ans  =
  65535

--> iconvert(-1, 14)
 ans  =
  4294967295

--> iconvert(-1, 18)
 ans  =
  18446744073709551615

Смотрите также

  • int8 — преобразование в однобайтное представление целого числа
  • inttype — возвращает тип целых чисел, используемых в типах целочисленных данных
  • double — converts inttype integers or booleans into decimal encoding
  • dec2bin — преобразование из десятичной системы счисления в двоичную
  • dec2base — преобразование десятичного числа в число системы счисления по основанию N в строке

История

ВерсияОписание
6.0
  • Support to int64 and uint64 encodings added.
  • This is now instead of
    iconvert([-%inf,%inf], 1)[-128, 127][0, 0]
    iconvert([-%inf,%inf], 2)[-32768, 32767][0, 0]
    iconvert(%inf, 4) 2147483647 -2147483648
    iconvert(%inf, 11) 255 0
    iconvert(%inf, 12) 65535 0
    iconvert(%inf, 14) 4294967295 0
Report an issue
<< Целые числа Целые числа int8 >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:05:05 CET 2019