From a8b15f586f8f9e40e4941ac4148dca6705ce744c Mon Sep 17 00:00:00 2001 From: tetragon Date: Wed, 16 May 2007 23:22:22 +0000 Subject: More test coverage of LedgerSMB.pm and re-expression of round_amount git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1201 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'LedgerSMB.pm') diff --git a/LedgerSMB.pm b/LedgerSMB.pm index 3581dfe7..c07276bb 100755 --- a/LedgerSMB.pm +++ b/LedgerSMB.pm @@ -410,12 +410,19 @@ sub round_amount { # These rounding rules follow from the previous implementation. # They should be changed to allow different rules for different accounts. - Math::BigFloat->round_mode('+inf') if $amount >= 0; - Math::BigFloat->round_mode('-inf') if $amount < 0; + if ($amount >= 0) { + Math::BigFloat->round_mode('+inf'); + } + else { + Math::BigFloat->round_mode('-inf'); + } - $amount = Math::BigFloat->new($amount)->ffround( -$places ) if $places >= 0; - $amount = Math::BigFloat->new($amount)->ffround( -( $places - 1 ) ) - if $places < 0; + if ($places >= 0) { + $amount = Math::BigFloat->new($amount)->ffround( -$places ); + } + else { + $amount = Math::BigFloat->new($amount)->ffround( -( $places - 1 ) ); + } return $amount; } -- cgit v1.2.3