Pluxbox Logo

Round operations block

Purpose

This information concerns a series of blocks that can round decimal numbers. Every block has value and precision.
Possible operations:

  • Ceil (Always round up)
  • Floor (Always round down)
  • Round (Normal rounding)

Note: Using Lodash_ functions for all math operations.

Input

  • Value
    Takes a decimal to be rounded. Triggers an output immediately.

  • Precision
    Takes a number to determine how many decimals to keep after the rounding. Does not trigger an output, if the value isn't set yet.
    If precision isn't set, the default is 0 decimals and the output is guaranteed to be a whole number.

Output

  • Value
    A decimal number after the rounding operation.

Example

graph LR
A(['5.15546']) --Value--> I(Rund Number)
B(['2']) --Precision--> I
I --Value--> C(['5.16'])

Caveats

  • Make sure precision is set before the value is provided. Otherwise, you trigger another output when precision is set. (e.g. output1 = 5, output2 = 5.16)
  • The value is never forgotten. This makes it impossible to set a new precision, without triggering an old output.