Studio Yotsuba
Back to Node List

Numeric Compare

compare

Compares two numbers and returns true or false

Reviewed
Guide available

Input Ports

NameTypeDescription
A
a
Number
Required
First number to compare
B
b
Number
Required
Second number to compare

Output Ports

NameTypeDescription
Result
result
Bool
Comparison result

Parameters

NameTypeDefaultRangeDescription / Options
Operation
op
Enum
Equal—

Choose how to compare A and B

  • EqualEqual
    True when |A - B| is less than 1e-9
  • NotEqualNotEqual
    True when |A - B| is at least 1e-9
  • LessThanLessThan
    a < b
  • LessEqualLessEqual
    a <= b
  • GreaterThanGreaterThan
    a > b
  • GreaterEqualGreaterEqual
    a >= b

What is it for?

  • Testing whether a value has crossed a threshold
  • Producing a Bool for the condition of a Switch
  • Building a condition such as "move only while this value is greater than 0"

Overview

Compares two numbers and returns true or false. It is the entry point for adding conditions to a graph. Connect its Bool output to a switch condition or to the on/off input of a gate.

Usage tips

  • The standard three-node pattern is value → compare (against a threshold) → switch (or gate). This creates step changes such as changing color after time passes 0.5.
  • Pairing it with a waveform creates a periodic condition. motion (Wobble) → compare (GreaterThan 0) yields true only during the first half of the wave, effectively a Bool version of a square wave.
  • Equal / NotEqual use a fixed absolute-difference threshold of 1e-9, not exact equality. Use Value Match's approximate mode when you need a configurable tolerance.

Related nodes

  • switch — choose a value from the comparison result
  • gate — stop a chain based on the comparison result
  • value_match — test equality for text, colors, and other non-numeric values
  • expression_float — write compound conditions as an expression

Comparison modes

  • Equal
    • Returns true when |A - B| is less than 1e-9.
  • NotEqual
    • Returns true when |A - B| is at least 1e-9.
  • LessThan
    • Returns true when A is less than B.
  • LessEqual
    • Returns true when A is less than or equal to B.
  • GreaterThan
    • Returns true when A is greater than B.
  • GreaterEqual
    • Returns true when A is greater than or equal to B.

Notes

  • This node is numeric only.
  • You can mix Int and Float inputs.
  • The fixed 1e-9 threshold for Equal / NotEqual cannot be changed in the Inspector.
  • To test whether text, colors, or other values are equal or different, use Value Match.

Examples

  1. Compare the result of Math Op with 0.5 using GreaterThan
    • Tests whether it exceeds 0.5.
  2. Compare with 0 using Equal
    • Tests whether the input is 0.
  3. Compare Numeric Input with 100 using LessEqual
    • Produces true only when the input is 100 or less.
  4. Connect the result of Compare to Switch
    • This is the basic branching pattern.
Back to Node List