I've been working on a script that takes data from an Excel spreadsheet, rounds the numbers, and removes the decimal point, for example, 2606.89579999999 becomes 26069. However, I need the number to round to two decimal places even if there would be a trailing zero, so 2606.89579999999 should become 260690.
I currently have it so i
takes the data from the cell in Excel, and rounds it to two decimal places (i = round(i, 2)
) which gives me the single decimal point in the above example.
I've tried figuring out how to get this to work with Decimal
, but I can't seem to get it working.
All other numbers that get rounded, if the rounded value doesn't end in '0', work fine with round(i, 2)
, but if the numbers just so happen to end in *.x0, that 0 gets dropped off and messes with the data.