ProtoFlux:Sign: Difference between revisions

From Resonite Wiki
Created a page for the SIgn node.
 
cleanup
 
Line 12: Line 12:
|}}
|}}


The <code>Sign</code> node takes in a number, and returns the sign represented as either a 1 (positive) or a -1 (negative). If the number is a zero (0), then it returns a zero (0).
The '''Sign''' node takes in a number and returns a <code>-1</code>, <code>0</code>, or <code>1</code> depending on the sign of the number.
 
{{Note|Inputting <code>Infinity</code> makes it a 1 (positive), <code>-Infinity</code> makes it a -1 (negative), and <code>NaN</code> makes it a zero (0).|information}}


== Inputs ==
== Inputs ==


=== N (Pseudo-generic) ===  
=== N (Pseudo-generic) ===


The number to check the sign of.
The number to check the sign of.
Line 26: Line 24:
=== * (Pseudo-generic) ===
=== * (Pseudo-generic) ===


Returns the sign of that number represented as a 1 (positive), a -1 (negative), or a zero (0).
Returns the sign of <code>N</code> of the same type represented as a 1 (positive), a -1 (negative), or a zero (0). If <code>N</code> is <code>Infinity</code> or <code>-Infinity</code>, a <code>1</code> or <code>-1</code> is returned, respectively. If <code>N</code> is <code>NaN</code>, <code>0</code> is returned. If <code>N</code> is a type with multiple fields, each field is signed individually.
 
== See Also ==
* [https://learn.microsoft.com/en-us/dotnet/api/system.math.sign Microsoft documentation for the <code>Math.Sign</code> method].


[[Category:ProtoFlux:Math]]
[[Category:ProtoFlux:Math]]

Latest revision as of 18:38, 6 June 2024

Sign
N
*
Math

The Sign node takes in a number and returns a -1, 0, or 1 depending on the sign of the number.

Inputs

N (Pseudo-generic)

The number to check the sign of.

Outputs

* (Pseudo-generic)

Returns the sign of N of the same type represented as a 1 (positive), a -1 (negative), or a zero (0). If N is Infinity or -Infinity, a 1 or -1 is returned, respectively. If N is NaN, 0 is returned. If N is a type with multiple fields, each field is signed individually.

See Also