Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Currency Rounding Up

Options
2»

Comments

  • Moderators, Technology & Internet Moderators Posts: 1,334 Mod ✭✭✭✭croo


    EyeSight wrote: »
    out of sheer curiosity, would €50.009 = €50 also?
    in money related software is it the standard to always round down no matter how high the offset is??
    Not to fork the OP's thread... but there are many rounding methods. The most common being round half up ... which most people are familiar with and would round your €50.009 to €50.01. But one method I came across is called "bankers' rounding" or "round half to even" where, as its name implies, it only rounds up (after half) to an even number. When I happened across the bankers' rounding I thought it must be an error but wikipedia has a good article on the subject that enlightened me http://en.wikipedia.org/wiki/Rounding


  • Registered Users Posts: 3,299 ✭✭✭irishguy


    I used to work for a large bank they used either 6 or 8 digits after the decimal place. If you apply it consistently to all transactions (ensure your OS and Database support this) then you will have Zero balancing problems.


  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    I found a list of rounding algorithms here: Rounding Algorithms 101

    # Round-Ceiling (Positive Infinity)
    # Round-Away From-Zero

    These are what my case needed.

    round-summary.gif


  • Closed Accounts Posts: 2,696 ✭✭✭mark renton


    ^^

    looks to me it may have come from your text book :D


  • Closed Accounts Posts: 695 ✭✭✭yawha


    Giblet wrote: »
    That won't work, you truncate x and add .01, so you'll always have x.01 as the number if there is a remainder in the 100's or less.
    x +- .01f;
    x = ((int)x * 100) / 100.0f
    
    This will truncate after two decimal places correctly
    God dammit. Brain was not functioning. You're correct.


  • Advertisement
  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    john47832 wrote: »
    ^^

    looks to me it may have come from your text book :D

    129176578250159225.jpg


Advertisement