I want to round off the amount in 5 cents. I tried that formula amount = amount+0.05; amount = amount *5; amount = amount /5; is this correct?
2026-03-25 22:26:07.1774477567
what is exact formula of round off 5 cent?
46 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
So let $A$ be the ammount. (Example: $23.27$)
Then $\frac A{0.05} = \frac {100A}5 = 20A$ is the number of $.05$ units the amount contains. (Example: $23.27$ has $465.4$ such units.)
Then we must round $20A$ to the nearest unit. So $round(20A)$ is the closest number of units (Example: $465$.)
Then you multiply but $0.05$ to get $0.05(round(20A))$ the nearest amount (Example $0.05(round(20*23.27))=0.05(round(465.4)) = 0.05\times 465 = 23.25$.)
If you want a formula for how to round you can use $\lfloor \rfloor$ and function. If $k - \lfloor k \rfloor < \frac 12$ then $round(k) = \lfloor k \rfloor$. If $k - \lfloor k \rfloor \ge \frac 12$ then $round (k) = \lfloor k \rfloor + 1$
So rounding $A$ to the nearest $m$ is
$m\times($ if $\lfloor \frac Am \rfloor < \frac 12$ then $\lfloor \frac Am \rfloor$; else $\lfloor \frac Am \rfloor + 1)$
In the case of $m = 0.05$ it is
$0.05\times ($ if $20A - \lfloor 20A \rfloor < \frac 12$ then $\lfloor 20A \rfloor$; else $\lfloor 20A \rfloor + 1)$.
So to round $1,459.98$
$0.05\times ($ if $20*1,459.98-\lfloor 20*1,459.98 \rfloor < \frac 12$ then $\lfloor 20*1,459.98 \rfloor$; else $\lfloor 20*1,459.98 \rfloor + 1)=$
$0.05\times ($ if $29199.6 -\lfloor 29199.6 \rfloor < \frac 12$ then $\lfloor 29199.6 \rfloor$; else $\lfloor 29199.6 \rfloor + 1)=$
$0.05\times ($ if $29199.6 - 29199 < \frac 12$ then $29199 $; else $ 29199 + 1)=$
$0.05\times ($ if $0.6 < \frac 12$ then $29199 $; else $29200)=$
$0.05\times (29200)=1460.00$