122337b06f6e3da1425115f3365a42247eb1059d
[scilab.git] / scilab / modules / elementary_functions / help / en_US / integer_representation / dec2base.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) 2011 - DIGITEO - Allan CORNET
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:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="dec2base" xml:lang="en">
17     <refnamediv>
18         <refname>dec2base</refname>
19         <refpurpose>Convert decimal to base N number in string</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>
24            str = dec2base(d, base)
25            str = dec2base(d, base, n)
26         </synopsis>
27     </refsynopsisdiv>
28     <refsection>
29         <title>Arguments</title>
30         <variablelist>
31             <varlistentry>
32                 <term>str</term>
33                 <listitem>
34                     <para>matrix of strings corresponding to "base" representation</para>
35                 </listitem>
36             </varlistentry>
37             <varlistentry>
38                 <term>base</term>
39                 <listitem>
40                     <para>1-by-1 matrix of doubles, positive integer value, the base</para>
41                 </listitem>
42             </varlistentry>
43             <varlistentry>
44                 <term>d</term>
45                 <listitem>
46                     <para>matrix of doubles, positive integer values</para>
47                 </listitem>
48             </varlistentry>
49         </variablelist>
50     </refsection>
51     <refsection>
52         <title>Description</title>
53         <para>
54             <literal>str = dec2base(d, base)</literal> converts the nonnegative integer values of <literal>d</literal> to the specified base <literal>base</literal>.
55         </para>
56         <para>
57             <literal>d</literal> must have a nonnegative integers smaller than 2^52, and <literal>base</literal> must be an integer between 2 and 36.
58         </para>
59         <para>
60             The returned argument <literal>str</literal> is a matrix of strings.
61         </para>
62         <para>
63             <literal>str = dec2base(d, base, n)</literal> produces a representation with at least <literal>n</literal> digits.
64         </para>
65     </refsection>
66     <refsection>
67         <title>Examples</title>
68         <programlisting role="example"><![CDATA[
69 for b = 2:36
70  disp( dec2base(666, b) )
71 end
72  ]]></programlisting>
73     </refsection>
74     <refsection role="see also">
75         <title>See also</title>
76         <simplelist type="inline">
77             <member>
78                 <link linkend="base2dec">base2dec</link>
79             </member>
80             <member>
81                 <link linkend="bin2dec">bin2dec</link>
82             </member>
83             <member>
84                 <link linkend="oct2dec">oct2dec</link>
85             </member>
86             <member>
87                 <link linkend="hex2dec">hex2dec</link>
88             </member>
89             <member>
90                 <link linkend="dec2bin">dec2bin</link>
91             </member>
92             <member>
93                 <link linkend="dec2oct">dec2oct</link>
94             </member>
95             <member>
96                 <link linkend="dec2hex">dec2hex</link>
97             </member>
98         </simplelist>
99     </refsection>
100     <refsection>
101         <title>History</title>
102         <revhistory>
103             <revision>
104                 <revnumber>5.4.0</revnumber>
105                 <revremark>This function was added in Scilab 5.4.0</revremark>
106             </revision>
107         </revhistory>
108     </refsection>
109 </refentry>