| 1 | |
| 2 | <refentry id="divz"> |
| 3 | <indexterm id="IndexDivz"><primary>divz</primary></indexterm> |
| 4 | <refentryinfo><title>Mathematical Operations:Opcode Equivalents of Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>divz</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>divz</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Safely divides two numbers. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Syntax</title> |
| 21 | <synopsis>ares <command>divz</command> xa, xb, ksubst</synopsis> |
| 22 | <synopsis>ires <command>divz</command> ia, ib, isubst</synopsis> |
| 23 | <synopsis>kres <command>divz</command> ka, kb, ksubst</synopsis> |
| 24 | <synopsis>...<command>divz</command>(ka, kb, ksubst)... (no rate restriction)</synopsis> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Description</title> |
| 29 | <para> |
| 30 | Safely divides two numbers. |
| 31 | </para> |
| 32 | </refsect1> |
| 33 | |
| 34 | <refsect1> |
| 35 | <title>Initialization</title> |
| 36 | <para> |
| 37 | Whenever <emphasis>b</emphasis> is not zero, set the result to the value <emphasis>a / b</emphasis>; when <emphasis>b</emphasis> is zero, set it to the value of <emphasis>subst</emphasis> instead. |
| 38 | </para> |
| 39 | </refsect1> |
| 40 | |
| 41 | <refsect1> |
| 42 | <title>Examples</title> |
| 43 | <para> |
| 44 | Here is an example of the divz opcode. It uses the file <ulink url="examples/divz.csd"><citetitle>divz.csd</citetitle></ulink>. |
| 45 | |
| 46 | <example> |
| 47 | <title>Example of the divz opcode.</title> |
| 48 | |
| 49 | |
| 50 | |
| 51 | <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> |
| 52 | <xi:include href="examples-xml/divz.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 53 | </example> |
| 54 | |
| 55 | Its output should include lines like: |
| 56 | <screen> |
| 57 | 200.000000 / 0.000000 = -1.000000 |
| 58 | 200.000000 / 66.757370 = 2.995924 |
| 59 | 200.000000 / 133.514739 = 1.497962</screen> |
| 60 | </para> |
| 61 | </refsect1> |
| 62 | |
| 63 | <refsect1> |
| 64 | <title>See also</title> |
| 65 | <para><link linkend="MathOpeqfunc"><citetitle>Opcode Equivalents of Functions</citetitle></link></para> |
| 66 | </refsect1> |
| 67 | |
| 68 | <refsect1> |
| 69 | <title>Credits</title> |
| 70 | <para>Author: &namejohn; after an idea by &namebarry;</para> |
| 71 | <para>Example written by &namekevin;.</para> |
| 72 | <para>Functional form available in csound Version 6.00</para> |
| 73 | </refsect1> |
| 74 | </refentry> |