Round to cents
FreeLogic@rabbinatix/round-to-cents by Rabbinatixupdated Oct 4, 2026
Rounds an amount to 2 decimals, halves up: `1.235` becomes `1.24`.
Use it before showing or storing money. Every language the code is exported to rounds the same way.
Shows: Round with a number of decimals.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick Round to cents. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
amount: Number
Outputs
rounded: Number
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 2 outputs. step 1 of 3
Round to cents
amount
Round, Math. 2 inputs, 1 output. step 2 of 3
Round
value
decimals
result
Return, Input / output. 2 inputs, 0 outputs. step 3 of 3
Return
rounded
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 2/2 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| Rounds down | {"amount":1.234} | {"rounded":1.23} | |
| Rounds up to a whole | {"amount":19.999} | {"rounded":20} |
Try it
Versions
In this package
Round to cents (entry)
