Studio Yotsuba
Back to Node List

Math Op

math_op

Applies a binary arithmetic operation to two numbers

Reviewed
Guide available

Input Ports

NameTypeDescription
A
a
Number
Required
Left-hand numeric input
B
b
Number
Required
Right-hand numeric input

Output Ports

NameTypeDescription
Value
value
Number
Arithmetic result

Parameters

NameTypeDefaultRangeDescription / Options
Operation
op
Enum
Add—

Arithmetic operation to apply

  • AddAdd
    a + b
  • SubtractSubtract
    a - b
  • MultiplyMultiply
    a * b
  • DivideDivide
    a / b
  • MinMin
    Smaller of a and b
  • MaxMax
    Larger of a and b
  • ModuloModulo
    Euclidean modulo in the range 0 up to |b|
  • PowerPower
    a raised to b

What is it for?

  • Adding two values to offset a position or strength
  • Multiplying by a factor to control intensity
  • Preparing a value for a threshold calculation or Compare
  • Combining parameters into a new value

Overview

The graph's calculator node, supporting arithmetic, min/max, modulo, and power for two numbers. It is the basic building block for numeric wiring that combines parameters into new values.

Usage tips

  • Processing waveform outputs is a common use: choose Multiply to change amplitude or Add to shift the center. For simple cases, a single remap may be easier to read.
  • Modulo makes values periodic by folding positive or negative inputs into a repeating range from 0 (inclusive) to |B| (exclusive).
  • Min / Max guarantee upper or lower bounds. For example, Max(value, 0.1) guarantees a minimum value.
  • For three or more terms or a complex expression, consolidating the calculation in expression_float usually makes the graph easier to read.

Related nodes

  • math_func — one-input functions such as absolute value, rounding, and trigonometry
  • expression_float — evaluate a complex expression in one node
  • remap / clamp — dedicated range conversion and limiting nodes
  • float_input / int_input — supply constants

Operations

  • Add
    • Addition: A + B
    • Example: inputs 2 and 3 produce 5.
  • Subtract
    • Subtraction: A - B
    • Example: inputs 5 and 2 produce 3.
  • Multiply
    • Multiplication: A * B
    • Example: inputs 4 and 3 produce 12.
  • Divide
    • Division: A / B
    • Example: inputs 7 and 2 produce 3.5.
  • Min
    • Returns the smaller input.
  • Max
    • Returns the larger input.
  • Modulo
    • Returns the Euclidean remainder in the range 0 <= result < |B|.
    • Example: inputs -7 and 3 produce 2.
  • Power
    • Exponentiation. Returns A to the power of B.
    • Example: inputs 2 and 3 produce 8.

Notes

  • Divide and Modulo produce an error when B = 0.
  • Add / Subtract / Multiply / Min / Max / Modulo preserve an Int runtime value when both inputs are Int.
  • Divide and Power may produce fractional results even when the inputs are integers.
  • You cannot connect Bool or Image; this node accepts numbers only.

Examples

  1. Add Float Input(0.25) and Float Input(0.5)
    • The result is 0.75.
    • Use this to combine offsets or correction values.
  2. Multiply the output of Noise by 0.5 with Math Op(Multiply)
    • Halves the movement range or strength.
  3. Use Math Op(Subtract) to calculate current value - threshold, then pass it to Compare
    • This works as preprocessing for a condition.
  4. Use Math Op(Max) to set a guaranteed minimum value
    • Useful for preventing values from becoming too small.
Back to Node List