* Bug #6693 fixed - modulo did not accept polynomial inputs. Help page was not updated.
[scilab.git] / scilab / modules / elementary_functions / help / en_US / modulo.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  * Copyright (C) 2013 - Samuel GOUGEON
6  * 
7  * This file must be used under the terms of the CeCILL.
8  * This source file is licensed as described in the file COPYING, which
9  * you should have received as part of this distribution.  The terms
10  * are also available at    
11  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12  *
13  -->
14 <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="modulo" xml:lang="en">
15     <refnamediv>
16         <refname>modulo</refname>
17         <refpurpose>symmetric arithmetic remainder modulo m</refpurpose>
18     </refnamediv>
19     <refnamediv xml:id="pmodulo">
20         <refname>pmodulo</refname>
21         <refpurpose>positive arithmetic remainder modulo m</refpurpose>
22     </refnamediv>
23     <refsynopsisdiv>
24         <title>Calling Sequence</title>
25         <synopsis>i = modulo(n,m)</synopsis>
26         <synopsis>i = pmodulo(n,m)</synopsis>
27     </refsynopsisdiv>
28     <refsection>
29         <title>Arguments</title>
30         <variablelist>
31             <varlistentry>
32                 <term>n</term>
33                 <listitem>
34                     <para>real or polynomial vector or matrix </para>
35                 </listitem>
36             </varlistentry>
37             <varlistentry>
38                 <term>m</term>
39                 <listitem>
40                     <para>real or polynomial vector or matrix </para>
41                 </listitem>
42             </varlistentry>
43         </variablelist>
44     </refsection>
45     <refsection>
46         <title>Description</title>
47         <para>
48             <function>modulo</function> computes <code>i = n (modulo
49                 m)
50             </code>
51             i.e. remainder of <varname>n</varname> divided by
52             <varname>m</varname>.
53         </para>
54         <para>
55             <code>i = n - m .* int (n ./ m)</code>. Here the answer may be negative
56             if <varname>n</varname> or <varname>m</varname> are negative.
57         </para>
58         <para>
59             <function>pmodulo</function> computes <code>i = n - |m| .* floor (n
60                 ./ |m|)
61             </code>
62             , the answer is positive or zero.
63         </para>
64         <para>
65             <code>modulo(x,0)</code> returns an error message: "Division by zero...". With ieee(2), <code>modulo(x,0)</code> returns <constant>%nan</constant>.
66         </para>
67         <para>
68             <code>pmodulo(x,0)</code> returns an error message: "Division by zero...". With ieee(2), <code>pmodulo(x,0)</code> returns <constant>%nan</constant>.
69         </para>
70     </refsection>
71     <refsection>
72         <title>Remark</title>
73         <para><note>
74                 If m and n are vector or matrix type, m and n must have the same dimensions.
75             </note>
76         </para>
77     </refsection>
78     <refsection>
79         <title>Examples</title>
80         <programlisting role="example"><![CDATA[ 
81 n = [1,2,10,15];
82 m = [2,2,3,5];
83 modulo(n,m)
84
85 modulo(-3, 9)
86 modulo(10, -4)
87
88 pmodulo(-3, 9)
89 pmodulo(10, -6)
90 pmodulo(-10, -6)
91  ]]></programlisting>
92     </refsection>
93 </refentry>