ProtoFlux:Pow: Difference between revisions

From Resonite Wiki
Created a page for the Pow node.
 
Added a specific math rotation node visual to this page.
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
|Inputs=
|Inputs=
[
[
{"Name":"N", "Type":"float"},
{"Name":"N", "Type":"Dummy"},
{"Name":"Power", "Type":"float"}
{"Name":"Power", "Type":"Dummy"}
]
]
|Outputs=
|Outputs=
[
[
{"Name":"*", "Type":"float"}
{"Name":"*", "Type":"Dummy"}
]
]
|}}
|}}


The <code>Pow</code> node takes in a base number and a power to raise the base to, then returns the result.
{{#Invoke:ProtoFlux|GenerateUI
|Name=Pow
|Category=Rotation
|Inputs=
[
{"Name":"Q", "Type":"Dummy"},
{"Name":"Pow", "Type":"Dummy"}
]
|Outputs=
[
{"Name":"*", "Type":"Dummy"}
]
|}}
 
The '''Pow''' node takes in a base number and a power to raise the base to, then returns the result.
 
{{Note|For quick and easy nodes that can square and cube, there are the [[ProtoFlux:Value Square|Value Square]] and [[ProtoFlux:Value Cube|Value Cube]] nodes.|suggestion}}


== Inputs ==
== Inputs ==


=== N ([[Type:float|float]]) ===  
=== N (Pseudo-generic) ===


The base number for this node.
The base number for this node.


=== Power ([[Type:float|float]]) ===
=== Power (Pseudo-generic) ===


The exponent (or power) for this node.
The exponent (or power) for this node.
Line 27: Line 43:
== Outputs ==
== Outputs ==


=== * ([[Type:float|float]]) ===
=== * (Pseudo-generic) ===


Returns the result of the base raised to the power.
Returns the result of the base raised to the power.
The following special cases are of note, in order of precedence:
* <code>N</code> or <code>Power</code> is <code>NaN</code>: always <code>NaN</code>
* <code>Power</code> is <code>Infinity</code>
** <code>-1 < N < 1</code>: <code>0</code>
** <code>N == 1</code>: <code>1</code>
** <code>N == -1</code>: <code>NaN</code>
** <code>Infinity</code> otherwise.
* <code>N < 0 && Power < 0 && Power is not an integer</code>: <code>NaN


== Examples ==
== Examples ==

Latest revision as of 23:24, 24 July 2024

N
*
Power
Math
Pow
Q
*
Pow
Rotation

The Pow node takes in a base number and a power to raise the base to, then returns the result.

For quick and easy nodes that can square and cube, there are the Value Square and Value Cube nodes.

Inputs

N (Pseudo-generic)

The base number for this node.

Power (Pseudo-generic)

The exponent (or power) for this node.

Outputs

* (Pseudo-generic)

Returns the result of the base raised to the power.

The following special cases are of note, in order of precedence:

  • N or Power is NaN: always NaN
  • Power is Infinity
    • -1 < N < 1: 0
    • N == 1: 1
    • N == -1: NaN
    • Infinity otherwise.
  • N < 0 && Power < 0 && Power is not an integer: NaN

Examples

Suppose we have the base number 3 and an exponent of 4. This is written as 3⁴.

To calculate 3⁴:

3⁴ = 3 × 3 × 3 × 3 = 81

In this example:

   The base is 3.
   The exponent is 4.
   3⁴ is read as "three to the power of four" or "three raised to the fourth power."