| 1 | |
| 2 | <refentry id="abs"> |
| 3 | <indexterm id="IndexAbs"><primary>abs</primary></indexterm> |
| 4 | <refentryinfo><title>Mathematical Operations:Mathematical Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>abs</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>abs</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Returns an absolute value. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Returns the absolute value of <emphasis>x</emphasis>. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis><command>abs</command>(x) (no rate |
| 29 | restriction)</synopsis> |
| 30 | <synopsis><command>abs</command>(k/i[]) (k- or i-arrays )</synopsis> |
| 31 | |
| 32 | <para> |
| 33 | where the argument within the parentheses may be an expression. Value converters perform arithmetic translation from units of one kind to units of another. The result can then be a term in a further expression. |
| 34 | </para> |
| 35 | </refsect1> |
| 36 | |
| 37 | <refsect1> |
| 38 | <title>Examples</title> |
| 39 | <para> |
| 40 | Here is an example of the abs opcode. It uses the file <ulink url="examples/abs.csd"><citetitle>abs.csd</citetitle></ulink>. |
| 41 | |
| 42 | <example> |
| 43 | <title>Example of the abs opcode.</title> |
| 44 | |
| 45 | |
| 46 | |
| 47 | <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> |
| 48 | <xi:include href="examples-xml/abs.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 49 | </example> |
| 50 | |
| 51 | Its output should include lines like: |
| 52 | <screen> |
| 53 | instr 1: iabs = 0.000 |
| 54 | instr 1: iabs = 0.150 |
| 55 | instr 1: iabs = 13.000 |
| 56 | </screen> |
| 57 | </para> |
| 58 | </refsect1> |
| 59 | |
| 60 | <refsect1> |
| 61 | <title>See also</title> |
| 62 | <para><link linkend="MathMatfunc"><citetitle>Mathematical Functions</citetitle></link></para> |
| 63 | </refsect1> |
| 64 | |
| 65 | </refentry> |