Title: Precision Rounding Error
Last modified: August 21, 2016

---

# Precision Rounding Error

 *  [Dewey Bushaw](https://wordpress.org/support/users/styledev/)
 * (@styledev)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/precision-rounding-error/)
 * Line 113
 * $totals -> cart_contents_total = $totals -> cart_contents_total + round(($totals-
   > cart_contents_total*$extra_charges)/100);
 * When using the round function you should specify the rounding precision:
 * $totals -> cart_contents_total = $totals -> cart_contents_total + round(($totals-
   > cart_contents_total*$extra_charges)/100,2);
 * That aside, the line should really just be:
 * $totals -> cart_contents_total = $totals -> cart_contents_total * (1+($extra_charges/
   100));
 * As WooCommerce handles rounding later down the way.
 * [http://wordpress.org/plugins/woocommerce-add-extra-charges-option-to-payment-gateways/](http://wordpress.org/plugins/woocommerce-add-extra-charges-option-to-payment-gateways/)

The topic ‘Precision Rounding Error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-add-extra-charges-option-
   to-payment-gateways_ebebeb.svg)
 * [WooCommerce Add Charges To Payment Gateway](https://wordpress.org/plugins/woocommerce-add-extra-charges-option-to-payment-gateways/)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-add-extra-charges-option-to-payment-gateways/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-add-extra-charges-option-to-payment-gateways/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-add-extra-charges-option-to-payment-gateways/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-add-extra-charges-option-to-payment-gateways/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Dewey Bushaw](https://wordpress.org/support/users/styledev/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/precision-rounding-error/)
 * Status: not resolved