coldfusion - rounding to nearest 5 cents

Go To StackoverFlow.com

1

In coldfusion, how does one round a decimal to the nearest 5 cents? So that a figure of 0.39675 would round up to 0.40. And if the figure was 0.3690, it would round down to 0.35. I can't seem to find anything useful via google.

Sorry for the brief question, but I think that's all I can really input.

2012-04-04 23:56
by user460114


11

Multiply by 20, round it, divide by 20:

  RoundedNumber = ( Round( Number * 20 ) / 20 )
2012-04-05 00:15
by Busches
Many thanks, perfect - user460114 2012-04-05 00:29
Ads