Skip to main content

Floor

This node rounds a number down to the nearest integer.

The Floor node performs the floor mathematical function.

The Floor node takes a numeric input and rounds it down to the next smallest integer. For example, 4.9 becomes 4, and -4.1 becomes -5. It includes validation to ensure the input is a valid number within safe limits.

Inputs

Input

DataDescription
ValueThe number to round down. Default: 0.

Actions

SignalDescription
DoTriggers the calculation. The result is updated only when this signal is received.

Outputs

Data

DataDescription
Floor ValueThe rounded integer result.

Signals

SignalDescription
DoneTriggered when the calculation is successfully completed.

Usage

Use this node when you need to discard the fractional part of a number or ensure a value is an integer rounded down.

Example Use Cases

  1. Index Calculation: Converting a continuous coordinate to a grid index.
    • X Position / Cell Size = 3.7.
    • Floor(3.7) = Index 3.
  2. Time: Converting seconds to minutes.
    • Total Seconds / 60.
    • Floor gives whole minutes.
  3. Random Integers: Often used after generating a random float to get an integer index.

Detailed Behavior

  1. Validation:
    • Input must be a valid number.
    • Input and Result must be within ±1,000,000,000,000.
  2. Calculation:
    • Uses Math.floor().
    • Triggered only by the Do signal.
  3. Error Handling:
    • If the result exceeds the allowed range, an error is logged and Done is not signaled.

Troubleshooting

  • Negative Numbers: Remember that Floor rounds down. So -4.1 becomes -5, not -4. Use Round or Ceil if this is not desired.