I want to round a number to the next lower .95:
20.84 -> 19.95
31.40 -> 30.95
45.34 _> 44.95
57.47 -> 56.95
How can I do this?
>Solution :
Since it easy to round down to the next integer, you can do what you want like this:
- add 0.05
- round down to the next integer
- subtract 0.05 again
Step 1 is necessary to avoid converting e.g. 2.98 to 1.95.
In Python code:
def round_down_95(x):
return int(x + 0.05) - 0.05