roundTo()
Round a numeric value to a chosen number of decimal places — use before showing prices, tax lines, or commission amounts so visitors see clean figures.
Syntax
Every formula in Calcopolis must start with = in the Value field:
= roundTo(number, precision)
| Part |
Rule |
| Function name |
roundTo — camelCase |
| Arguments |
Two, separated by a comma |
number |
Value or expression to round |
precision |
Number of digits after the decimal point (0 = whole numbers) |
| Return value |
Rounded number (still numeric, not a text string) |
Valid examples
= roundTo(monthly_payment, 2)
= roundTo(tax_rate * subtotal, 2)
= roundTo(average_order_value, 0)
= roundTo(unit_price * qty, 2)
Invalid / unsupported
| Don't write |
Why |
roundTo(x) |
Both number and precision are required |
round(x, 2) |
Use roundTo, not round |
{{ x | number:2 }} in a formula |
Use roundTo in = formulas; number pipe is for Custom Text / Table templates |
Parameters
| Argument |
Description |
number |
The value to round — variable, literal, or expression. |
precision |
Decimal places. 2 for cents; 0 for whole units. |
When to use roundTo()
Use roundTo() when intermediate math produces long decimals you do not want in Result widgets:
| Situation |
What roundTo() does |
| Currency lines |
Two decimal places on totals and tax |
| Commission % |
Round partner payout before summing |
| Whole packages |
Round recommended bundle size to integers |
| Displayed rates |
Consistent APR or fee display |
For text output with currency symbols, combine a rounded variable with the currency pipe in Custom Text: {{ monthly_payment | currency:2:USD }}
Practical examples (ecommerce & leads)
1. Clean monthly payment
| Variable |
Formula |
monthly_raw |
= loanInstallmentAmount(amount, rate/100, months) |
monthly_payment |
= roundTo(monthly_raw, 2) |
2. Tax line on ecommerce quote
| Variable |
Formula |
tax |
= roundTo(subtotal * tax_rate, 2) |
grand_total |
= roundTo(subtotal + tax + shipping, 2) |
3. Recommended order quantity (whole boxes)
| Variable |
Formula |
boxes_needed |
= roundTo(units_needed / units_per_box, 0) |
Where to use it
| Location |
Supported |
| Result widget Value |
Yes — = ... formulas |
| Standalone variable (Variables tab) |
Yes |
| Number / other input default Value |
Yes, if formula-driven |
| Visibility formula |
Yes |
| Custom Text / Table cells |
No — use {{ }} templates there, not = functions |
After editing, run Calculate (or enable Run calculation on load in project Options) to refresh results.