Expand my Community achievements bar.

# Workfront Fusion

The Community Advisors application is now OPEN for the second class of 2024. Apply to become a part of this exclusive program!
SOLVED

## Rounding with decimals

Level 6

I can't find a way to round a number to a specific number of decimals. So e.g. 3.14159 to 3.1416 or 3.14

I'm surely missing something. Any ideas where to find that function?

1 Accepted Solution

Employee

Hi Chris,

We use round, but have to extend the number past the decimal range first because our round() feature only rounds to the nearest integer.

Using this method on 3.14159 i get

The formulas to handle this look like this:

So, again , you round the number multiplied by the factor of the digits you want then divide the newly rounded integer by the same factor

4 Replies

Level 4

formatNumber under math functions. ~Jeff

Level 6

Hi @Jeff Rieth‚ thanks for the answer. I tried that but it just cuts off at the defined decimal number, it doesn't round :-(

Employee

Hi Chris,

We use round, but have to extend the number past the decimal range first because our round() feature only rounds to the nearest integer.

Using this method on 3.14159 i get

The formulas to handle this look like this:

So, again , you round the number multiplied by the factor of the digits you want then divide the newly rounded integer by the same factor

Level 6

@Andy Hess‚ thanks for the solution! Perhaps it makes sense that this finds its way into the documentation?