Rounding down decimal

Hi,

I have built this expression

@crmRoundDecimal(@divide(@toDecimal(.TransactionAmount),1.2),2)

If you use a calculator in figure 10.71 the output is 8.925 so when i add that figure into my expression the out is 8.93

So you can see it is rounding x.xx5 up, however I want it to round down, so the output is 8.92

Any ideas?

Thanks

Craig

@CraigC5577 The best solution depends on what the requirements are. Your example mentions you want to round 8.925 to 8.92, that would be rounding of mode HALF_DOWN.

What about 8.926 or 8.9299?

Would you want that to round to 8.93 (also HALF_DOWN) or would you also want that to result in 8.92, then that’s truncating any decimal after the second (or using rounding mode DOWN or FLOOR depending on your requirements when it comes to negative numbers).

@lordj1 Hi,

for 8.926 would like to round up to 8.93 and same with 8.9299

The way we are working out the output is dividing the input by 1.2 so if the output calculates after the second decimal is either (1.811) (1.812) (1.813) (1.814) (1.815) to keep the second at 1 , like 1.81 but if it calculates for example (1.816) (1.817) (1.818) (1.819) to round the second decimal to 2 like 1.82

How would I add the HALF_DOWN to my current expression @crmRoundDecimal(@divide(@toDecimal(.TransactionAmount),1.2),2)

.TransactionAmount is the input value

Thanks

Craig

** Updated

After some playing around, i set the text format to a decimal param and removed other parts, now it’s working as expected

@divide(Param.TransA,1.2,2,“half_down”)

Thanks reply, very helpful