Debian Codegraph @

opcodes/round.xml

raw symbols SCIP
1
2 <refentry id="round">
3 <indexterm id="IndexRound"><primary>round</primary></indexterm>
4 <refentryinfo><title>Mathematical Operations:Mathematical Functions</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>round</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>round</refname>
13
14 <refpurpose>
15 Returns the integer value nearest to <emphasis>x</emphasis>
16 ; if the fractional part of <emphasis>x</emphasis> is exactly 0.5, the direction of rounding
17 is undefined and may depend on the host operating system and Csound version.
18 </refpurpose>
19 </refnamediv>
20
21 <refsect1>
22 <title>Description</title>
23 <para>
24 The integer value nearest to
25 <emphasis>x</emphasis>
26 ; if the fractional part of <emphasis>x</emphasis> is exactly 0.5, the direction of rounding
27 is undefined.
28 </para>
29 </refsect1>
30
31 <refsect1>
32 <title>Syntax</title>
33 <synopsis><command>round</command>(x) (init-, control-, or audio-rate arg allowed)</synopsis>
34 <synopsis><command>round</command>(k/i[]) (k- or i-arrays )</synopsis>
35 <para>
36 where the argument within the parentheses may be an expression.
37 Value converters perform arithmetic translation from units of
38 one kind to units of another. The result can then be a term in a
39 further expression.
40 </para>
41 </refsect1>
42
43 <refsect1>
44 <title>Examples</title>
45 <para>
46 Here is an example of the round opcode. It uses the file <ulink url="examples/round.csd"><citetitle>round.csd</citetitle></ulink>.
47 <example>
48 <title>Example of the round opcode.</title>
49 <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>
50 <xi:include href="examples-xml/round.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
51 </example>
52 Its output should include a line like these:
53 <screen>
54 instr 1: inumber = 9.000 idiv = 1.000 ifl = 9.000
55 instr 1: inumber = 9.000 idiv = 2.000 ifl = 5.000
56 instr 1: inumber = 9.000 idiv = 3.000 ifl = 3.000
57 instr 1: inumber = 9.000 idiv = 4.000 ifl = 2.000
58 instr 1: inumber = 9.000 idiv = 5.000 ifl = 2.000
59 instr 1: inumber = 9.000 idiv = 6.000 ifl = 2.000
60 instr 1: inumber = 9.000 idiv = 7.000 ifl = 1.000
61 instr 1: inumber = 9.000 idiv = 8.000 ifl = 1.000
62 instr 1: inumber = 9.000 idiv = 9.000 ifl = 1.000
63 instr 1: inumber = 9.000 idiv = 10.000 ifl = 1.000
64 </screen>
65 Here is an example for the rounding-group, comparing the different rounding opcodes. It uses the file <ulink url="examples/rounding-group.csd"><citetitle>rounding-group.csd</citetitle></ulink>.
66 <example>
67 <title>Example of the rounding group.</title>
68 <xi:include href="examples-xml/rounding-group.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
69 </example>
70 </para>
71 </refsect1>
72
73 <refsect1>
74 <title>See also</title>
75 <para><link linkend="MathMatfunc"><citetitle>Mathematical Functions</citetitle></link></para>
76 </refsect1>
77
78 <refsect1>
79 <title>Credits</title>
80 <para>
81 <simplelist>
82 <member>Author: Istvan Varga</member>
83 <member>New in Csound 5</member>
84 <member>2005</member>
85 </simplelist>
86 </para>
87 </refsect1>
88 </refentry>