-
Notifications
You must be signed in to change notification settings - Fork 29
/
adds.xml
121 lines (100 loc) · 3.77 KB
/
adds.xml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<refentry id="adds">
<indexterm id="IndexPlus"><primary>+</primary></indexterm>
<refentryinfo><title>Mathematical Operations:Arithmetic and Logic Operations</title></refentryinfo>
<refmeta>
<refentrytitle>+</refentrytitle>
</refmeta>
<refnamediv>
<refname>+</refname>
<refpurpose>
Addition operator
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
Arithmetic operators perform operations of change-sign (negate), do-no-change-sign, logical AND logical OR, add, subtract, multiply and divide. Note that a value or an expression may fall between two of these operators, either of which could take it as its left or right argument, as in
<literallayout>
a + b * c.
</literallayout>
</para>
<para>
In such cases three rules apply:
</para>
<para>
1. * and <emphasis>/</emphasis> bind to their neighbors more strongly than + and −. Thus the above expression is taken as
<literallayout>
a + (b * c)
</literallayout>
with * taking b and c and then + taking a and b * c.
</para>
<para>
2. <emphasis>+</emphasis> and <emphasis>−</emphasis>
bind more strongly than &&, which in turn is stronger
than ||:
<literallayout>
a && b - c || d
</literallayout>
is taken as
<literallayout>
(a && (b - c)) || d
</literallayout>
</para>
<para>
3. When both operators bind equally strongly, the operations are done left to right:
<literallayout>
a - b - c
</literallayout>
is taken as
<literallayout>
(a - b) - c
</literallayout>
</para>
<para>
Parentheses may be used as above to force particular groupings.
</para>
</refsect1>
<refsect1>
<title>Syntax</title>
<synopsis><command>+</command>a (no rate restriction)</synopsis>
<synopsis>a <command>+</command> b (no rate restriction)</synopsis>
<para>
where the arguments <emphasis>a</emphasis> and <emphasis>b</emphasis> may be further expressions.
</para>
</refsect1>
<refsect1>
<title>Arguments</title>
<para>
The arguments of + can be scalar values or k-rate one
dimensional arrays (vectors), or any combination. If one of the
arguments is an array, so is the value.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Here is an example of the + operator. It uses the file <ulink url="examples/adds.csd"><citetitle>adds.csd</citetitle></ulink>.
<example>
<title>Example of the + operator.</title>
<para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
<xi:include href="examples-xml/adds.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<link linkend="subtracts"><citetitle>-</citetitle></link>,
<link linkend="opand"><citetitle>&&</citetitle></link>,
<link linkend="opor"><citetitle>||</citetitle></link>,
<link linkend="multiplies"><citetitle>*</citetitle></link>,
<link linkend="divides"><citetitle>/</citetitle></link>,
<link linkend="raises"><citetitle>ˆ</citetitle></link>,
<link linkend="modulus"><citetitle>%</citetitle></link>
</para>
</refsect1>
<refsect1>
<title>Credits</title>
<para>Arithmetic on vectors is new in version 6.00</para>
</refsect1>
</refentry>