forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiv.lcdoc
More file actions
74 lines (52 loc) · 2.17 KB
/
div.lcdoc
File metadata and controls
74 lines (52 loc) · 2.17 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Name: div
Type: operator
Syntax: <number> div <divisor>
Summary:
Divides one number by another and <return|returns> the <integer> part of
the result.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
4 div 2 -- evaluates to 2
Example:
11 div 4 -- evaluates to 2 (since 11/4 = 2.75)
Example:
arrayOfNumbers div 10
Parameters:
number:
A number, or an expression that evaluates to a number, or an array
containing only numbers.
divisor:
Any non-zero number. If the number is an array, the divisor is either a
non-zero number or an array containing only non-zero numbers.
The result:
>*Note:* While using non-integer <number> and <divisor> usually produces
> sensible results, mathematically, integer division is generally
> defined as a function over the integers, and the results using
> non-integers may not consistently be what you expect.
Description:
Use the <div> <operator> to do integer division.
If the <number> to be divided is an <array>, each of the <array>
<element(glossary)|elements> must be a number. If an <array> is divided
by a number, each <element(keyword)> is divided by the number. If an
<array> is divided by an <array>, both <array|arrays> must have the same
number of <element(glossary)|elements> and the same dimension, and each
<element(keyword)> in one <array> is divided by the corresponding
<element(keyword)> of the other <array>.
If an element of an array is empty, the <div> <operator> treats its
contents as zero.
The expression dividend div divisor is equivalent to
trunc(dividend/divisor).
If dividend can be divided evenly into <divisor>, the <expression>
dividend div divisor is equal to dividend/divisor.
If a math operation on finite inputs produces a non-finite output, an
execution error is thrown. See <math operation|math operations> for more
information.
Changes:
The option to divide arrays was introduced in version 1.1. In previous
versions, only single numbers could be used with the div operator.
References: operator (glossary), array (glossary), element (glossary),
return (glossary), expression (glossary), integer (keyword),
element (keyword), / (operator), math operation (glossary)
Tags: math