Revision 73a78da6
Von Rolf Fluehmann vor fast 9 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
947 | 947 |
} |
948 | 948 |
|
949 | 949 |
sub round_amount { |
950 |
my ($self, $amount, $places) = @_; |
|
950 |
my ($self, $amount, $places, $adjust) = @_;
|
|
951 | 951 |
|
952 | 952 |
return 0 if !defined $amount; |
953 | 953 |
|
954 |
if ($adjust) { |
|
955 |
my $precision = $::instance_conf->get_precision || 0.01; |
|
956 |
return $self->round_amount( $self->round_amount($amount / $precision, 0) * $precision, $places); |
|
957 |
} |
|
958 |
|
|
954 | 959 |
# We use Perl's knowledge of string representation for |
955 | 960 |
# rounding. First, convert the floating point number to a string |
956 | 961 |
# with a high number of places. Then split the string on the decimal |
Auch abrufbar als: Unified diff
Form: round_amount precision support