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
| Data | Description |
|---|---|
| Value | The number to round down. Default: 0. |
Actions
| Signal | Description |
|---|---|
| Do | Triggers the calculation. The result is updated only when this signal is received. |
Outputs
Data
| Data | Description |
|---|---|
| Floor Value | The rounded integer result. |
Signals
| Signal | Description |
|---|---|
| Done | Triggered 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
- Index Calculation: Converting a continuous coordinate to a grid index.
X Position/Cell Size=3.7.- Floor(
3.7) = Index3.
- Time: Converting seconds to minutes.
Total Seconds/60.- Floor gives whole minutes.
- Random Integers: Often used after generating a random float to get an integer index.
Detailed Behavior
- Validation:
- Input must be a valid number.
- Input and Result must be within ±1,000,000,000,000.
- Calculation:
- Uses
Math.floor(). - Triggered only by the
Dosignal.
- Uses
- Error Handling:
- If the result exceeds the allowed range, an error is logged and
Doneis not signaled.
- If the result exceeds the allowed range, an error is logged and
Troubleshooting
- Negative Numbers: Remember that
Floorrounds down. So-4.1becomes-5, not-4. UseRoundorCeilif this is not desired.