From: ivan Date: Thu, 2 Apr 2009 02:36:41 +0000 (+0000) Subject: more than you ever wanted to know about rounding. http://en.wikipedia.org/wiki/Round... X-Git-Tag: root_of_svc_elec_features~1311 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=f319a3e27955cc3351f04c12a663f978a6e3d2a3 more than you ever wanted to know about rounding. en.wikipedia.org/wiki/Rounding RT#4666 --- diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index f14f14402..c745283d1 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -457,9 +457,11 @@ sub calc_recur { $included_min{$regionnum} -= $minutes; if ( $included_min{$regionnum} < 0 ) { - my $charge_min = 0 - $included_min{$regionnum}; + my $charge_min = 0 - $included_min{$regionnum}; #XXX should preserve + #(display?) this $included_min{$regionnum} = 0; - $charge = sprintf('%.2f', $rate_detail->min_charge * $charge_min ); + $charge = sprintf('%.2f', ( $rate_detail->min_charge * $charge_min ) + + 0.00000001 ); #so 1.005 rounds to 1.01 $charges += $charge; }