0616874cea1dc3a56b0cad1a17d1cc8d3d4bdd77
[scilab.git] / scilab / modules / elementary_functions / help / en_US / bitwise / bitor.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * 
4  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5  * Copyright (C) 2011 - DIGITEO - Michael Baudin
6  * Copyright (C) 2008 - INRIA
7  * 
8  * Copyright (C) 2012 - 2016 - Scilab Enterprises
9  *
10  * This file is hereby licensed under the terms of the GNU GPL v2.0,
11  * pursuant to article 5.3.4 of the CeCILL v.2.1.
12  * This file was originally licensed under the terms of the CeCILL v2.1,
13  * and continues to be available under such terms.
14  * For more information, see the COPYING file which you should have received
15  * along with this program.
16  * 
17  -->
18 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="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="bitor" xml:lang="en">
19     <refnamediv>
20         <refname>bitor</refname>
21         <refpurpose>bitwise OR</refpurpose>
22     </refnamediv>
23     <refsynopsisdiv>
24         <title>Syntax</title>
25         <synopsis>
26             z = bitor(x, y)            
27         </synopsis>
28     </refsynopsisdiv>
29     <refsection>
30         <title>Parameters</title>
31         <variablelist>
32             <varlistentry>
33                 <term>x :</term>
34                 <listitem>
35                     <para>
36                         a <literal>m</literal>-by-<literal>n</literal> matrix of doubles
37                         or a <literal>m1</literal>-by-<literal>m2</literal>-by-...-by-<literal>mm</literal> hypermatrix of doubles
38                         or a <literal>m</literal>-by-<literal>n</literal> matrix of unsigned integers (<literal>uint8</literal>, <literal>uint16</literal> or <literal>uint32</literal>).
39                         Must contain positive integer values.
40                     </para>
41                 </listitem>
42             </varlistentry>
43             <varlistentry>
44                 <term>y :</term>
45                 <listitem>
46                     <para>
47                         a <literal>m</literal>-by-<literal>n</literal> matrix of doubles
48                         or a <literal>m1</literal>-by-<literal>m2</literal>-by-...-by-<literal>mm</literal> hypermatrix of doubles
49                         or a <literal>m</literal>-by-<literal>n</literal> matrix of unsigned integers (<literal>uint8</literal>, <literal>uint16</literal> or <literal>uint32</literal>).
50                         Must contain positive integer values.
51                     </para>
52                 </listitem>
53             </varlistentry>
54             <varlistentry>
55                 <term>z :</term>
56                 <listitem>
57                     <para>
58                         a <literal>m</literal>-by-<literal>n</literal> matrix of doubles
59                         or a <literal>m1</literal>-by-<literal>m2</literal>-by-...-by-<literal>mm</literal> hypermatrix of doubles
60                         or a <literal>m</literal>-by-<literal>n</literal> matrix of  integers.
61                     </para>
62                 </listitem>
63             </varlistentry>
64         </variablelist>
65     </refsection>
66     <refsection>
67         <title>Description</title>
68         <para>
69             Given <varname>x</varname> and <varname>y</varname> two positive integers, this function returns the decimal
70             number <varname>z</varname> whose the binary form is the OR of the binary representations
71             of <varname>x</varname> and <varname>y</varname>.
72         </para>
73         <para>
74             <varname>x</varname>, <varname>y</varname>, <varname>z</varname> have the same size.
75         </para>
76     </refsection>
77     <refsection>
78         <title>Examples</title>
79         <programlisting role="example"><![CDATA[
80 // '110000' : is the binary representation of 48 
81 // '100101' : is the binary representation of 37   
82 // '110101' : is the binary representation for the OR applied to the binary forms 48 and 37 
83 // so the decimal number corresponding to the OR  applied to binary forms 48 and 37 is : 53
84 x=48; 
85 y=37;
86 z=bitor(x,y)
87
88 // Compute the bitwise OR of two matrices of doubles.
89 x=[12,45]; 
90 y=[25,49];
91 z=bitor(x,y)
92
93 // Compute the bitwise OR of two matrices of doubles.
94 x = [0 1 0 1];
95 y = [0 0 1 1];
96 z = bitor(x, y)
97 expected = [0 1 1 1];
98
99 // Compute the bitwise OR of two matrices of integers.
100 x = uint8([0 1 0 1]);
101 y = uint8([0 0 1 1]);
102 z = bitor(x, y)
103
104 // The types of x and y cannot be mixed (error).
105 x = [0 1 0 1];
106 y = uint8([0 0 1 1]);
107 // z = bitor(x, y)
108
109 //  13 is (01101)_2
110 //  27 is (11011)_2
111 //  OR is (11111)_2 which is 31.
112 bitor(uint8(13), uint8(27))
113 bitor(13, 27)
114
115    ]]></programlisting>
116     </refsection>
117     <refsection role="see also">
118         <title>See also</title>
119         <simplelist type="inline">
120             <member>
121                 <link linkend="bitand">bitand</link>
122             </member>
123             <member>
124                 <link linkend="bin2dec">bin2dec</link>
125             </member>
126             <member>
127                 <link linkend="dec2bin">dec2bin</link>
128             </member>
129         </simplelist>
130     </refsection>
131 </refentry>