what is exact formula of round off 5 cent? [closed]












0














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?










share|cite|improve this question















closed as unclear what you're asking by Brahadeesh, Cyclohexanol., José Carlos Santos, Christopher, Rebellos Nov 27 at 15:50


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • No idea what you think $amount = amount + 0.05$ and $amount = amount* 5$ and $amount = amount/5$ is supposed to mean or why they would have anything to do with rounding to the nearest five cents
    – fleablood
    Nov 27 at 5:37










  • You should scale the amount, use the nearest-integer function, then un-scale the result.
    – Chase Ryan Taylor
    Nov 27 at 5:39
















0














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?










share|cite|improve this question















closed as unclear what you're asking by Brahadeesh, Cyclohexanol., José Carlos Santos, Christopher, Rebellos Nov 27 at 15:50


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • No idea what you think $amount = amount + 0.05$ and $amount = amount* 5$ and $amount = amount/5$ is supposed to mean or why they would have anything to do with rounding to the nearest five cents
    – fleablood
    Nov 27 at 5:37










  • You should scale the amount, use the nearest-integer function, then un-scale the result.
    – Chase Ryan Taylor
    Nov 27 at 5:39














0












0








0







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?










share|cite|improve this question















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?







calculator






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 4 at 4:21









clathratus

3,052330




3,052330










asked Nov 27 at 5:26









Developer1205

1033




1033




closed as unclear what you're asking by Brahadeesh, Cyclohexanol., José Carlos Santos, Christopher, Rebellos Nov 27 at 15:50


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Brahadeesh, Cyclohexanol., José Carlos Santos, Christopher, Rebellos Nov 27 at 15:50


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • No idea what you think $amount = amount + 0.05$ and $amount = amount* 5$ and $amount = amount/5$ is supposed to mean or why they would have anything to do with rounding to the nearest five cents
    – fleablood
    Nov 27 at 5:37










  • You should scale the amount, use the nearest-integer function, then un-scale the result.
    – Chase Ryan Taylor
    Nov 27 at 5:39


















  • No idea what you think $amount = amount + 0.05$ and $amount = amount* 5$ and $amount = amount/5$ is supposed to mean or why they would have anything to do with rounding to the nearest five cents
    – fleablood
    Nov 27 at 5:37










  • You should scale the amount, use the nearest-integer function, then un-scale the result.
    – Chase Ryan Taylor
    Nov 27 at 5:39
















No idea what you think $amount = amount + 0.05$ and $amount = amount* 5$ and $amount = amount/5$ is supposed to mean or why they would have anything to do with rounding to the nearest five cents
– fleablood
Nov 27 at 5:37




No idea what you think $amount = amount + 0.05$ and $amount = amount* 5$ and $amount = amount/5$ is supposed to mean or why they would have anything to do with rounding to the nearest five cents
– fleablood
Nov 27 at 5:37












You should scale the amount, use the nearest-integer function, then un-scale the result.
– Chase Ryan Taylor
Nov 27 at 5:39




You should scale the amount, use the nearest-integer function, then un-scale the result.
– Chase Ryan Taylor
Nov 27 at 5:39










1 Answer
1






active

oldest

votes


















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.05times 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



$mtimes($ 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.05times ($ if $20A - lfloor 20A rfloor < frac 12$ then $lfloor 20A rfloor$; else $lfloor 20A rfloor + 1)$.



So to round $1,459.98$



$0.05times ($ 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.05times ($ if $29199.6 -lfloor 29199.6 rfloor < frac 12$ then $lfloor 29199.6 rfloor$; else $lfloor 29199.6 rfloor + 1)=$



$0.05times ($ if $29199.6 - 29199 < frac 12$ then $29199 $; else $ 29199 + 1)=$



$0.05times ($ if $0.6 < frac 12$ then $29199 $; else $29200)=$



$0.05times (29200)=1460.00$






share|cite|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    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.05times 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



    $mtimes($ 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.05times ($ if $20A - lfloor 20A rfloor < frac 12$ then $lfloor 20A rfloor$; else $lfloor 20A rfloor + 1)$.



    So to round $1,459.98$



    $0.05times ($ 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.05times ($ if $29199.6 -lfloor 29199.6 rfloor < frac 12$ then $lfloor 29199.6 rfloor$; else $lfloor 29199.6 rfloor + 1)=$



    $0.05times ($ if $29199.6 - 29199 < frac 12$ then $29199 $; else $ 29199 + 1)=$



    $0.05times ($ if $0.6 < frac 12$ then $29199 $; else $29200)=$



    $0.05times (29200)=1460.00$






    share|cite|improve this answer


























      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.05times 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



      $mtimes($ 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.05times ($ if $20A - lfloor 20A rfloor < frac 12$ then $lfloor 20A rfloor$; else $lfloor 20A rfloor + 1)$.



      So to round $1,459.98$



      $0.05times ($ 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.05times ($ if $29199.6 -lfloor 29199.6 rfloor < frac 12$ then $lfloor 29199.6 rfloor$; else $lfloor 29199.6 rfloor + 1)=$



      $0.05times ($ if $29199.6 - 29199 < frac 12$ then $29199 $; else $ 29199 + 1)=$



      $0.05times ($ if $0.6 < frac 12$ then $29199 $; else $29200)=$



      $0.05times (29200)=1460.00$






      share|cite|improve this answer
























        1












        1








        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.05times 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



        $mtimes($ 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.05times ($ if $20A - lfloor 20A rfloor < frac 12$ then $lfloor 20A rfloor$; else $lfloor 20A rfloor + 1)$.



        So to round $1,459.98$



        $0.05times ($ 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.05times ($ if $29199.6 -lfloor 29199.6 rfloor < frac 12$ then $lfloor 29199.6 rfloor$; else $lfloor 29199.6 rfloor + 1)=$



        $0.05times ($ if $29199.6 - 29199 < frac 12$ then $29199 $; else $ 29199 + 1)=$



        $0.05times ($ if $0.6 < frac 12$ then $29199 $; else $29200)=$



        $0.05times (29200)=1460.00$






        share|cite|improve this answer












        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.05times 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



        $mtimes($ 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.05times ($ if $20A - lfloor 20A rfloor < frac 12$ then $lfloor 20A rfloor$; else $lfloor 20A rfloor + 1)$.



        So to round $1,459.98$



        $0.05times ($ 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.05times ($ if $29199.6 -lfloor 29199.6 rfloor < frac 12$ then $lfloor 29199.6 rfloor$; else $lfloor 29199.6 rfloor + 1)=$



        $0.05times ($ if $29199.6 - 29199 < frac 12$ then $29199 $; else $ 29199 + 1)=$



        $0.05times ($ if $0.6 < frac 12$ then $29199 $; else $29200)=$



        $0.05times (29200)=1460.00$







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Nov 27 at 6:04









        fleablood

        68.1k22684




        68.1k22684















            Popular posts from this blog

            Bundesstraße 106

            Verónica Boquete

            Ida-Boy-Ed-Garten