| 1 | |
| 2 | <refentry id="log2"> |
| 3 | <indexterm id="IndexLog2"><primary>log2</primary></indexterm> |
| 4 | <refentryinfo><title>Mathematical Operations:Mathematical Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>log2</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>log2</refname> |
| 11 | <refpurpose> |
| 12 | Returns a base 2 log. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Returns the base 2 log of <emphasis>x</emphasis> (<emphasis>x</emphasis> positive only). |
| 20 | </para> |
| 21 | |
| 22 | <para> |
| 23 | The argument value is restricted for <link linkend="log"><citetitle>log</citetitle></link>, |
| 24 | <emphasis>log2</emphasis>, and <link linkend="sqrt"><citetitle>sqrt</citetitle></link>. |
| 25 | </para> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Syntax</title> |
| 30 | <synopsis><command>log2</command>(x) (no rate |
| 31 | restriction)</synopsis> |
| 32 | <synopsis><command>log2</command>(k/i[]) (k- or i-arrays )</synopsis> |
| 33 | |
| 34 | <para> |
| 35 | 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. |
| 36 | </para> |
| 37 | </refsect1> |
| 38 | |
| 39 | <refsect1> |
| 40 | <title>Examples</title> |
| 41 | <para> |
| 42 | Here is an example of the log2 opcode. It uses the file <ulink url="examples/log2.csd"><citetitle>log2.csd</citetitle></ulink>. |
| 43 | |
| 44 | <example> |
| 45 | <title>Example of the log2 opcode.</title> |
| 46 | <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> |
| 47 | <xi:include href="examples-xml/log2.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 48 | </example> |
| 49 | |
| 50 | Its output should include a line like this: |
| 51 | <screen>instr 1: i1 = 3.000</screen> |
| 52 | </para> |
| 53 | </refsect1> |
| 54 | |
| 55 | <refsect1> |
| 56 | <title>See also</title> |
| 57 | <para><link linkend="MathMatfunc"><citetitle>Mathematical Functions</citetitle></link></para> |
| 58 | </refsect1> |
| 59 | |
| 60 | <refsect1> |
| 61 | <title>Credits</title> |
| 62 | <para>Written by &namejohn;.</para> |
| 63 | <para>New in version 5.17.12</para> |
| 64 | </refsect1> |
| 65 | </refentry> |