summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-04-02 02:36:41 +0000
committerivan <ivan>2009-04-02 02:36:41 +0000
commitf319a3e27955cc3351f04c12a663f978a6e3d2a3 (patch)
treef9fcb44b8e16e1ad475dfaad3b2fbe3c3171124c /FS
parentd983a08166ca2bfcc16062a4e6820f8985569394 (diff)
more than you ever wanted to know about rounding. http://en.wikipedia.org/wiki/Rounding RT#4666
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm6
1 files changed, 4 insertions, 2 deletions
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;
}