Debian Codegraph @

opcodes/subtracts.xml

raw symbols SCIP
1
2 <refentry id="subtracts">
3 <indexterm id="IndexMinus"><primary>-</primary></indexterm>
4 <refentryinfo><title>Mathematical Operations:Arithmetic and Logic Operations</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>-</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>-</refname>
13
14 <refpurpose>
15 Subtraction operator.
16 </refpurpose>
17 </refnamediv>
18
19 <refsect1>
20 <title>Description</title>
21 <para>
22 Arithmetic operators perform operations of change-sign (negate), don't-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
23 <literallayout>
24 a + b * c.
25 </literallayout>
26 </para>
27
28 <para>
29 In such cases three rules apply:
30 </para>
31
32 <para>
33 1. &ast; and <emphasis>&sol;</emphasis> bind to their neighbors more strongly than &plus; and &minus;. Thus the above expression is taken as
34 <literallayout>
35 a + (b * c)
36 </literallayout>
37 with &ast; taking b and c and then &plus; taking a and b &ast; c.
38 </para>
39
40 <para>
41 2. <emphasis>&plus;</emphasis> and <emphasis>&minus;</emphasis> bind more strongly than &amp;&amp;, which in turn is stronger than &verbar;&verbar;:
42 <literallayout>
43 a &amp;&amp; b - c &verbar;&verbar; d
44 </literallayout>
45 is taken as
46 <literallayout>
47 (a &amp;&amp; (b - c)) &verbar;&verbar; d
48 </literallayout>
49 </para>
50
51 <para>
52 3. When both operators bind equally strongly, the operations are done left to right:
53 <literallayout>
54 a - b - c
55 </literallayout>
56 is taken as
57 <literallayout>
58 (a - b) - c
59 </literallayout>
60 </para>
61
62 <para>
63 Parentheses may be used as above to force particular groupings.
64 </para>
65 </refsect1>
66
67 <refsect1>
68 <title>Syntax</title>
69 <synopsis><command>&minus;</command>a (no rate restriction)</synopsis>
70 <synopsis>a <command>&minus;</command> b (no rate restriction)</synopsis>
71
72 <para>
73 where the arguments <emphasis>a</emphasis> and <emphasis>b</emphasis> may be further expressions.
74 </para>
75 </refsect1>
76
77 <refsect1>
78 <title>Arguments</title>
79 <para>
80 The arguments of &minus; can be scalar values or k-rate one
81 dimensional arrays (vectors), or any combination. If one of the
82 arguments is an array, so is the value.
83 </para>
84 </refsect1>
85
86
87 <refsect1>
88 <title>Examples</title>
89 <para>
90 Here is an example of the - operator. It uses the file <ulink url="examples/subtracts.csd"><citetitle>subtracts.csd</citetitle></ulink>.
91 <example>
92 <title>Example of the - operator.</title>
93 <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>
94 <xi:include href="examples-xml/subtracts.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
95 </example>
96 Its output should include lines like these:
97 <screen>
98 sutain time= note duration - attack - decay --> 3.0-0.1-0.2 = 2.7
99 sutain time= note duration - attack - decay --> 3.0-0.5-1.5 = 1.0
100 sutain time= note duration - attack - decay --> 5.0-4.0-0.5 = 0.5</screen>
101 </para>
102 </refsect1>
103
104 <refsect1>
105 <title>See also</title>
106 <para><link linkend="MathArtLogic"><citetitle>Arithmetic and Logic Operations</citetitle></link></para>
107 </refsect1>
108
109 <refsect1>
110 <title>Credits</title>
111 <para>Arithmetic on vectors is new in version 6.00</para>
112 </refsect1>
113
114 </refentry>