Announcement

Collapse
No announcement yet.

Rounding Problem While Applying Discounts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Rounding Problem While Applying Discounts

    I recently wrote some module code that gets the Basket_Total via the library function and discounts it from the order right before purchase. The discount works fine, the problem I'm having is that at times it shows a 0.01 total afterwards. That seems strange since I'm using the total provided by the library function. What am I missing here? What's the recommended way of solving this problem? Is this happening because of the built in ROUND operator? Any help is much appreciated.

    #2
    Re: Rounding Problem While Applying Discounts

    FYI, the Miva engine uses "banker's rounding," which is slightly different from the way were all taught to do it in grade school. You can Google it for details. That sometimes causes 1-cent errors. I can't tell if this applies to your specific case without knowing more about how you've implemented this discount.

    Hope that helps --
    Last edited by Kent Multer; 09-26-14, 08:37 AM.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment

    Working...
    X