<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA -
 * Copyright (C) 2018 - Samuel GOUGEON
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<!--  module: integer  -->
<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" xmlns:scilab="http://www.scilab.org"
    xml:lang="ja" xml:id="iconvert">
    <refnamediv>
        <refname>iconvert</refname>
        <refpurpose>1または8バイト整数表現に変換する</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>呼び出し手順</title>
        <synopsis>y = iconvert(X,itype)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>パラメータ</title>
        <variablelist>
            <varlistentry>
                <term>X</term>
                <listitem>
                    <para>浮動小数点数または整数の行列. Complex numbers are not accepted.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>y</term>
                <listitem>
                    <para>1,2,4または8バイト整数の行列.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>説明</title>
        <para>
            1, 2, 4, または 8バイト整数に変換し,保存します.
            Please refer to the <link linkend="int8">int8()</link> page for a detailled description.
        </para>
        <para>
            <table>
                <tr><th>itype</th><th>y typeof</th> <th>range</th></tr>
                <tr><th>0</th>  <td>(reals)</td>    <td></td></tr>
                <tr><th>1</th>  <td>int8</td>   <td>[-128, 127]</td></tr>
                <tr><th>2</th>  <td>int16</td>  <td>[-32768, 32767]</td></tr>
                <tr><th>4</th>  <td>int32</td>  <td>[-2147483648, 2147483647]</td></tr>
                <tr><th>8</th>  <td>int64</td>  <td>[-9223372036854775808, 9223372036854775807]</td></tr>
                <tr><th>11</th> <td>uint8</td>  <td>[0, 255]</td></tr>
                <tr><th>12</th> <td>uint16</td> <td>[0, 65535]</td></tr>
                <tr><th>14</th> <td>uint32</td> <td>[0, 4294967295]</td></tr>
                <tr><th>18</th> <td>uint64</td> <td>[0, 18446744073709551615]</td></tr>
            </table>
        </para>
        <warning>
            Converting <literal>[]</literal> always keeps it as is, of type 1 == inttype 0
           (decimal type).
        </warning>
    </refsection>
    <refsection>
        <title>例</title>
        <programlisting role="example"><![CDATA[
b=int32([1 -120 127 312])
y=iconvert(b,1)
 ]]></programlisting>
    <para/>
    <programlisting role="example"><![CDATA[
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)
 ]]></programlisting>
    <screen><![CDATA[
--> 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
]]></screen>
    </refsection>
    <refsection role="see also">
        <title>参照</title>
        <simplelist type="inline">
            <member>
                <link linkend="int8">int8</link>
            </member>
            <member>
                <link linkend="inttype">inttype</link>
            </member>
            <member>
                <link linkend="double">double</link>
            </member>
            <member>
                <link linkend="dec2bin">dec2bin</link>
            </member>
            <member>
                <link linkend="dec2base">dec2base</link>
            </member>
        </simplelist>
    </refsection>
    <refsection role="history">
        <title>履歴</title>
        <revhistory>
            <revision>
                <revnumber>6.0</revnumber>
                <revdescription>
                    <itemizedlist>
                        <listitem>
                            Support to int64 and uint64 encodings added.
                        </listitem>
                        <listitem>
                            <table>
                                <tr><th>This</th>              <th>is now</th>     <th>instead of</th></tr>
                                <tr><td>iconvert([-%inf,%inf], 1)</td><td>[-128, 127]</td><td>[0, 0]</td></tr>
                                <tr><td>iconvert([-%inf,%inf], 2)</td><td>[-32768, 32767]</td><td>[0, 0]</td></tr>
                                <tr><td>iconvert(%inf, 4)</td>  <td>2147483647</td> <td>-2147483648</td></tr>
                                <tr><td>iconvert(%inf, 11)</td> <td>255</td>        <td>0</td></tr>
                                <tr><td>iconvert(%inf, 12)</td> <td>65535</td>      <td>0</td></tr>
                                <tr><td>iconvert(%inf, 14)</td> <td>4294967295</td> <td>0</td></tr>
                            </table>
                        </listitem>
                    </itemizedlist>
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>
