The Alternative Csound Reference Manual
Previous |  | Next

# pow

pow -- Computes one argument to the power of another argument.

## Description

Computes xarg to the power of kpow (or ipow) and scales the result by inorm.

## Syntax

ar pow aarg, kpow [, inorm]

ir pow iarg, ipow [, inorm]

kr pow karg, kpow [, inorm]

## Initialization

inorm (optional, default=1) -- The number to divide the result (default to 1). This is especially useful if you are doing powers of a- or k- signals where samples out of range are extremely common!

## Performance

aarg, iarg, karg -- the base.

ipow, kpow -- the exponent.

| Use ^ with caution in arithmetical statements, as the precedence may not be correct. New in Csound version 3.493.

## Examples

Here is an example of the pow opcode. It uses the files pow.orc and pow.sco.

Example 1. Example of the pow opcode.

    /* pow.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; This could also be expressed as: i1 = 2 ^ 12
      i1 pow 2, 12

      print i1
    endin
    /* pow.orc */

    /* pow.sco */
    ; Play Instrument #1 for one second.
    i 1 0 1
    e
    /* pow.sco */

Its output should include a line like this:

    instr 1:  i1 = 4096.000

## Credits

Author: Paris Smaragdis
MIT, Cambridge
1995

Example written by Kevin Conder.

Previous | Home | Next
poscil3 | Up | powoftwo