| 1 | |
| 2 | <refentry id="frac"> |
| 3 | <indexterm id="IndexFrac"><primary>frac</primary></indexterm> |
| 4 | <refentryinfo><title>Mathematical Operations:Mathematical Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>frac</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>frac</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Returns the fractional part of a decimal number. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Returns the fractional part of <emphasis>x</emphasis>. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis><command>frac</command>(x) (init-rate or control-rate args; also works at audio rate in Csound5)</synopsis> |
| 29 | <synopsis><command>frac</command>(k/i[]) (k- or i-arrays )</synopsis> |
| 30 | <para> |
| 31 | 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. |
| 32 | </para> |
| 33 | </refsect1> |
| 34 | |
| 35 | <refsect1> |
| 36 | <title>Examples</title> |
| 37 | <para> |
| 38 | Here is an example of the frac opcode. It uses the file <ulink url="examples/frac.csd"><citetitle>frac.csd</citetitle></ulink>. |
| 39 | <example> |
| 40 | <title>Example of the frac opcode.</title> |
| 41 | <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> |
| 42 | <xi:include href="examples-xml/frac.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 43 | </example> |
| 44 | |
| 45 | Its output should include a line like this: |
| 46 | <screen> |
| 47 | instr 1: i2 = 0.200 |
| 48 | </screen> |
| 49 | </para> |
| 50 | <para> |
| 51 | Here is another example of the frac opcode. It uses the file <ulink url="examples/frac2.csd"><citetitle>frac2.csd</citetitle></ulink>. |
| 52 | <example> |
| 53 | <xi:include href="examples-xml/frac2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 54 | </example> |
| 55 | </para> |
| 56 | </refsect1> |
| 57 | |
| 58 | <refsect1> |
| 59 | <title>See also</title> |
| 60 | <para><link linkend="MathMatfunc"><citetitle>Mathematical Functions</citetitle></link></para> |
| 61 | </refsect1> |
| 62 | |
| 63 | <refsect1> |
| 64 | <title>Credits</title> |
| 65 | <para>Example written by &namekevin;.</para> |
| 66 | </refsect1> |
| 67 | </refentry> |