**Requirement:** I am attempting to use the ROUND function to limit a value to two decimal places. I have done this in the past by taking the input number (say 153.5569) and:

1. Multiply by 100: 15355.69

2. Round 15356

3. Divide by 100. 153.56

I generally have no issue doing this, however, I have run across some numbers that just do not seem to be rounding correctly. It appears to be rounding down to the nearest cent vs. up to the next cent as I would expect. All my examples that have issues seem to end in 5.

Example: input number which is not working as expected (278.965). Using the standard logic for rounding we have in our procedures:

1. Multiply by 100: 27896.5

2. Round. 27897

3. Divide by 100. 278.97

However, Adeptia is returning 278.96. When I walk through each step of the calculation, the problem occurs at the second step (round). It rounds down when I think it should round up.

**Solution:** Multiplying a number (end in 5) with 100, returns decimal place value like xxx.499999996 and allowing the Round function to generate incorrect value.

Hence, we need a number that will return 5 in the decimal places (without any conversion), when multiplying with an Input value. So, we find the following Textual rule, that will round off the number to 2 decimal places correctly.

`round($number * 1000 div 10) div 100`

here, * $number *is the Source node name/ input number.

## 0 Comments