ProtoFlux:Value Mod: Difference between revisions

From Resonite Wiki
Stub
 
Added a suggestion and link to the Div node page.
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
|Inputs=
|Inputs=
[
[
{"Type":"Dummy"},
{"Name":"A", "Type":"Dummy"},
{"Type":"Dummy"}
{"Name":"B", "Type":"Dummy"}
]
]
|Outputs=
|Outputs=
[
[
{"Type":"Dummy"}
{"Name":"*", "Type":"Dummy"}
]
]
|}}
|}}
The '''ValueMod''' node takes in 2 inputs and returns the remainder value of a division operation. This node goes by names such as "Modulus", "Modulo", and "Mod". (TODO: Does truncation/rounding come into play when using this as an int value compared to float values?)
{{Note|If you just want the result of a division, use the [[ProtoFlux:Div|Div]] node instead.|suggestion}}
{{Note|This node when using negative numbers (in the <code>A</code> input), will result in values that enter the excluded range of values (See image of the chart explaining the side effects). Using the [[ProtoFlux:Value Repeat|Value Repeat]] node will give different results.|warning}}
== Inputs ==
=== A (Pseudo-Generic) ===
Takes in the value for division, this is your current amount to check against.
=== B (Pseudo-Generic) ===
Takes in a value for division, this is your range, or how much you can fill in with your value before it rolls over and starting from 0.
== Outputs ==
=== * (Pseudo-Generic) ===
Returns the remainder value of a division operation.
== Examples ==
<gallery widths=480px heights=480px>File:Modulus_VS_Repeat_Node_01.png|A chart showing the difference between using Modulus and Repeat nodes (courtesy of GManAmby).</gallery>
== See Also ==
* Wikipedia's definition of the [https://en.wikipedia.org/wiki/Modulo Modulo Operator] in Computer Science.
* Microsoft's Documentation on both the [https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/arithmetic-operators Arithmetic Operators] and the [https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/mod-operator Mod] reserved keyword.


[[Category:ProtoFlux:Stubs]]
[[Category:ProtoFlux:Stubs]]
[[Category:ProtoFlux:Operators]]
[[Category:ProtoFlux:Operators]]

Latest revision as of 07:24, 27 June 2024

%
A
*
B
Operators

The ValueMod node takes in 2 inputs and returns the remainder value of a division operation. This node goes by names such as "Modulus", "Modulo", and "Mod". (TODO: Does truncation/rounding come into play when using this as an int value compared to float values?)

If you just want the result of a division, use the Div node instead.
This node when using negative numbers (in the A input), will result in values that enter the excluded range of values (See image of the chart explaining the side effects). Using the Value Repeat node will give different results.

Inputs

A (Pseudo-Generic)

Takes in the value for division, this is your current amount to check against.

B (Pseudo-Generic)

Takes in a value for division, this is your range, or how much you can fill in with your value before it rolls over and starting from 0.

Outputs

* (Pseudo-Generic)

Returns the remainder value of a division operation.

Examples

See Also