I have decimal currency amounts (from SQl2k* tables as 32,8) and I would like to round them to Millions with 2 decimal places.
The system will be displaying 1000s of rows with multiple amounts in them, and I need to summarise the totals for various categories into a “quick view”.
e.g.
123,456,789.12345678
goes to
123.46
6,655,443,332.2110099
goes to
6,655.44
etc
I know there are issues with rounding and decimal/floating point math:
45,454,454.454545
goes to
45.46 OR 45.45 ?
so also any advice on what’s best to use would also be very much appreciated.
Two more examples (of what I’d EXPECT…not what might actually be mathematically correct!)
555444444.444444 => 555.44
555444444.444445 => 555.45
I would expect the final “5” of the second example to cascade up to the decimal place?
1 Answer