fix floating point error in taxline, #21099
authorMark Wells <mark@freeside.biz>
Fri, 25 Jan 2013 01:22:58 +0000 (17:22 -0800)
committerMark Wells <mark@freeside.biz>
Fri, 25 Jan 2013 01:22:58 +0000 (17:22 -0800)
FS/FS/cust_main_county.pm

index 5733595..fb80809 100644 (file)
@@ -512,8 +512,10 @@ sub taxline {
   # now round and distribute
   my $extra_cents = sprintf('%.2f', $taxable_cents * $self->tax / 100) * 100
                     - $tax_cents;
+  # make sure we have an integer
+  $extra_cents = sprintf('%.0f', $extra_cents);
   if ( $extra_cents < 0 ) {
-    die "nonsense extra_cents value $extra_cents"; # because seriously, wtf
+    die "nonsense extra_cents value $extra_cents";
   }
   $tax_cents += $extra_cents;
   my $i = 0;