<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="powoftwo">
  <refmeta>
    <refentrytitle>powoftwo</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>powoftwo</refname>

    <refpurpose>
      Performs a  power-of-two calculation.
      <indexterm id="IndexPowoftwo"><primary>powoftwo</primary></indexterm>
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Description</title>
    <para>
      Performs a  power-of-two calculation.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>powoftwo</command>(x)  (init-rate or control-rate args only)</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>powoftwo</emphasis>() function returns 2 ^ <emphasis>x</emphasis> and allows positive and negatives numbers as argument. The range of values admitted in <emphasis>powoftwo</emphasis>() is -5 to +5 allowing a precision more fine than one cent in a range of ten octaves. If a greater range of values is required, use the slower opcode <link linkend="pow"><citetitle>pow</citetitle></link>.
    </para>

    <para>
      These functions are fast, because they read values stored in tables. Also they are very useful when working with tuning ratios. They work at i- and k-rate.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the powoftwo opcode. It uses the files <ulink url="examples/powoftwo.orc"><citetitle>powoftwo.orc</citetitle></ulink> and <ulink url="examples/powoftwo.sco"><citetitle>powoftwo.sco</citetitle></ulink>.

      <example>
        <title>Example of the powoftwo opcode.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/powoftwo.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/powoftwo.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>

      Its output should include a line like this:
      <screen>
instr 1:  i1 = 4096.000
      </screen>
    </para>
  </refsect1>


  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="logbtwo"><citetitle>logbtwo</citetitle></link>, 
      <link linkend="pow"><citetitle>pow</citetitle></link>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namegabriel;</member>
        <member>Italy</member>
        <member>June 1998</member>
      </simplelist>
    </para>

    <para>
      <simplelist>
        <member>Author: &namejohn;</member>
        <member>University of Bath, Codemist, Ltd.</member>
        <member>Bath, UK</member>
        <member>July 1999</member>
      </simplelist>
    </para>
    <para>Example written by &namekevin;.</para>

    <para>New in Csound version 3.57</para>
  </refsect1>
</refentry>
