diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-05-16 23:22:22 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-05-16 23:22:22 +0000 |
commit | a8b15f586f8f9e40e4941ac4148dca6705ce744c (patch) | |
tree | 72bd95436e617c48410725cec6fe5b314c2a1c93 /LedgerSMB.pm | |
parent | 89172b074ef8db7fbf9121ff13136c74ec102f29 (diff) |
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
Diffstat (limited to 'LedgerSMB.pm')
-rwxr-xr-x | LedgerSMB.pm | 17 |
1 files changed, 12 insertions, 5 deletions
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; } |