forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.xml
More file actions
47 lines (47 loc) · 3.38 KB
/
Copy pathmod.xml
File metadata and controls
47 lines (47 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<doc>
<legacy_id>2462</legacy_id>
<name>mod</name>
<type>operator</type>
<syntax>
<example><i>number</i> mod<i> divisor</i></example>
</syntax>
<library></library>
<objects>
</objects>
<synonyms>
</synonyms>
<classification>
<category>Math, Logic, & Dates</category>
</classification>
<references>
<operator tag="/">/ Operator</operator>
</references>
<history>
<introduced version="1.0">Added.</introduced>
<changed version="1.1"></changed>
</history>
<platforms>
<mac/>
<windows/>
<linux/>
<ios/>
<android/>
</platforms>
<classes>
<desktop/>
<server/>
<web/>
<mobile/>
</classes>
<security>
</security>
<summary>Evaluates to the <glossary tag="remainder">remainder</glossary> left over when one number is divided by another.</summary>
<examples>
<example>23 mod 5 <code><i>-- evaluates to 3 (23 div 5 is 4, with 3 left over)</i></code></example>
<example>12 mod 4 <code><i>-- evaluates to zero</i></code></example>
<example>23 mod -5 <code><i>-- evaluates to 3</i></code></example>
</examples>
<description>
<p>Use the <b>mod</b> <glossary tag="operator">operator</glossary> to perform modulus arithmetic.</p><p/><p><b>Parameters:</b></p><p>The <i>number</i> is a number, or an <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a number, or an <glossary tag="array">array</glossary> containing only numbers.</p><p/><p>The <i>divisor</i> is any non-zero number. If the <i>number</i> is an <glossary tag="array">array</glossary>, the <i>divisor</i> is either a non-zero number or an <glossary tag="array">array</glossary> containing only non-zero numbers.</p><p/><p><b>Comments:</b></p><p>If the <i>number</i> to be divided is an <glossary tag="array">array</glossary>, each of the <glossary tag="array">array</glossary> <glossary tag="element">elements</glossary> must be a number. If an <glossary tag="array">array</glossary> is divided by a number, each <keyword tag="element">element</keyword> is divided by the number. If an <glossary tag="array">array</glossary> is divided by an <glossary tag="array">array</glossary>, both <glossary tag="array">arrays</glossary> must have the same number of <glossary tag="element">elements</glossary> and the same dimension, and each <keyword tag="element">element</keyword> in one <glossary tag="array">array</glossary> is divided by the corresponding <keyword tag="element">element</keyword> of the other <glossary tag="array">array</glossary>.</p><p/><p>If an element of an array is empty, the <b>mod</b> <glossary tag="operator">operator</glossary> treats its contents as zero.</p><p/><p>If <i>number</i> can be divided evenly into <i>divisor</i>, the <glossary tag="expression">expression</glossary> <code>number mod divisor</code> is zero.</p><p/><p>Attempting to divide by zero causes an execution error.</p><p/><p><code/><b>Note:</b><code/> Using non-integer <i>number</i> and <i>divisor</i> usually produces sensible results. However, mathematically, modulus is generally defined as a function over the integers, and the results using non-integers may not consistently be what you expect.</p><p/><p><b>Changes:</b></p><p>The option to divide arrays was introduced in version 1.1. In previous versions, only single numbers could be used with the <b>mod</b> <glossary tag="operator">operator</glossary>.</p>
</description>
</doc>