da65333b7c3937218bb5c7b2b995c1df88168518
[scilab.git] / scilab / modules / integer / help / en_US / int8.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * 
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="int8">
17     <refnamediv>
18         <refname>int8</refname>
19         <refpurpose> conversion to one byte integer representation</refpurpose>
20     </refnamediv>
21     <refnamediv xml:id="int16">
22         <refname>int16</refname>
23         <refpurpose> conversion to 2 bytes integer representation</refpurpose>
24     </refnamediv>
25     <refnamediv xml:id="int32">
26         <refname>int32</refname>
27         <refpurpose> conversion to 4 bytes integer representation</refpurpose>
28     </refnamediv>
29     <refnamediv xml:id="uint8">
30         <refname>uint8</refname>
31         <refpurpose> conversion to one byte unsigned integer representation</refpurpose>
32     </refnamediv>
33     <refnamediv xml:id="uint16">
34         <refname>uint16</refname>
35         <refpurpose> conversion to 2 bytes unsigned integer representation</refpurpose>
36     </refnamediv>
37     <refnamediv xml:id="uint32">
38         <refname>uint32</refname>
39         <refpurpose> conversion to 4 bytes unsigned integer representation</refpurpose>
40     </refnamediv>
41     <refsynopsisdiv>
42         <title>Syntax</title>
43         <synopsis>y = int8(X)
44             y = int16(X)
45             y = int32(X)
46             y = uint8(X)
47             y = uint16(X)
48             y = uint32(X)
49         </synopsis>
50     </refsynopsisdiv>
51     <refsection>
52         <title>Arguments</title>
53         <variablelist>
54             <varlistentry>
55                 <term>X</term>
56                 <listitem>
57                     <para>a matrix of floats or integers.</para>
58                 </listitem>
59             </varlistentry>
60             <varlistentry>
61                 <term>y</term>
62                 <listitem>
63                     <para>a matrix of integers coded on one, two or four bytes.</para>
64                 </listitem>
65             </varlistentry>
66         </variablelist>
67     </refsection>
68     <refsection>
69         <title>Description</title>
70         <para>
71             These functions convert and store data to one, two or four bytes integers. These
72             data types are especially useful to store big objects such as images,
73             long signals,...
74         </para>
75         <variablelist>
76             <varlistentry>
77                 <term>y = int8(X)</term>
78                 <listitem>
79                     <para>
80                         return numbers in the range <literal>[-128, 127]</literal>
81                     </para>
82                 </listitem>
83             </varlistentry>
84             <varlistentry>
85                 <term>y = uint8(X)</term>
86                 <listitem>
87                     <para>
88                         return numbers in the range <literal>[0, 255]</literal>
89                     </para>
90                 </listitem>
91             </varlistentry>
92             <varlistentry>
93                 <term>y = int16(X)</term>
94                 <listitem>
95                     <para>
96                         return numbers in the range <literal>[-32768, 32767]</literal>
97                     </para>
98                 </listitem>
99             </varlistentry>
100             <varlistentry>
101                 <term>y = uint16(X)</term>
102                 <listitem>
103                     <para>
104                         return numbers in the range <literal>[0, 65535]</literal>
105                     </para>
106                 </listitem>
107             </varlistentry>
108             <varlistentry>
109                 <term>y = int32(X)</term>
110                 <listitem>
111                     <para>
112                         return numbers in the range <literal>[-2147483648, 2147483647]</literal>
113                     </para>
114                 </listitem>
115             </varlistentry>
116             <varlistentry>
117                 <term>y = uint32(X)</term>
118                 <listitem>
119                     <para>
120                         return numbers in the range <literal>[0, 4294967295]</literal>
121                     </para>
122                 </listitem>
123             </varlistentry>
124         </variablelist>
125         <para>
126             If <varname>X</varname> has numbers with a fractional part, Scilab rounds them
127             to the nearest integer toward zero.
128         </para>
129     </refsection>
130     <refsection>
131         <title>Examples</title>
132         <programlisting role="example"><![CDATA[ 
133 int8([1 -120 127 312])
134 uint8([1 -120 127 312])
135
136 x = int32(-200:100:400)
137 int8(x)
138
139 y = [-3.8, -3.5, -3.1, 3.1, 3.5, 3.8]
140 int8(y)
141  ]]></programlisting>
142     </refsection>
143     <refsection role="see also">
144         <title>See Also</title>
145         <simplelist type="inline">
146             <member>
147                 <link linkend="double">double</link>
148             </member>
149             <member>
150                 <link linkend="inttype">inttype</link>
151             </member>
152             <member>
153                 <link linkend="iconvert">iconvert</link>
154             </member>
155         </simplelist>
156     </refsection>
157 </refentry>