# S1^S2

## Overview

Raises sample values of all channels of input S1 to the power of the sample values of the same channels on input S2.## Operator ports

**Input S1**: Floating point values

**Input S2**: Floating point values

**Output S1^S2**: Floating point values

## Properties

Find more information about changing properties here: "Properties Viewer"Caption

*type: Word or phrase*

The name of the object in the project. This name must not contain '.', '$' nor '@' characters.

For more information about the rules and usage of the Caption property, please refer to "Caption property - background and usage".

Documentation

*type: See description*

Optional documentation of this object. If this object is an operator, the Documentation text is displayed below the operator symbol.

## Details

The front input of this operator respresents S1, the bottom input represents S2. S1 is the set of signals that is raised to the power of the input values at S2.If one input bus contains one channel and the other input contains more than one channel, the sample value of the single channel input is used to do the operation on the sample values of every channel of the other input.

S1 may be raised to the power of a fraction, which in effect results in the root of S1 (e.g. S1 to the power of 0.5 equals the

**square root**of S1).

The power operator detects invalid values, and will state an error message when such values are detected. If the power function results in an invalid value, then the last valid sample will remain unchanged at the output.

The power function results in invalid values, when: S1 < 0 and 0 < S2 < 1 (root of a negative number), or when the result of the power is too large to handle.

It is allowed to feedback a signal that originates from the output to the bottom input (S2).

It is not allowed to directly calculate the power from two different signal sources. You need to synchronize the signals first, using the Synchronizer ("Synchronizer").

The calculation is also performed on constant values (e.g. from a Constant ("K"); either if one of the inputs is a constant or both.

### Mathematical issues

You can use this operator to calculate the square root, by taking 0.5 for channels at S2, because x^(0.5) equals the square root of x. For the same, you can also calculate the cubic root, by taking 0.3333.. for channels at S2.There is however something to think about: Polybench uses the floating point processing in the CPU of the computer. Floating point values, by definition, cannot describe all real numbers; there is always a small error, because the value has to fit in a 64-bit binary value. For the cubic root, you need the power of 1/3; but 1/3 cannot be described by a floating point value. 1/3 becomes 0.33333..., which is never exactly 1/3.

This becomes a problem when you try to calculate, say the cubic root of a negative number, for example -27^(1/3) = -3. In Polybench there is no way to express 1/3; you must use 0.3333... But 0.3333.. is not precize enough to be a

*real*cubic root, therefore the calculation will fail, just like what happens if you try to calculate a square root of a negative number.

Technically speaking, the problem is that the standard floating point operations that Polybench performs are only expressed in real numbers, and not in imaginary numbers. Since there is no imaginary component, all root powers on negative numbers will fail. Polybench will issue a warning below the operator and output the last valid sample values if such a calculation occurs.