Revision 7915128c
Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
982 | 982 |
# part. If an overflow occurs then apply that overflow to the part |
983 | 983 |
# before the decimal sign as well using integer arithmetic again. |
984 | 984 |
|
985 |
my $amount_str = sprintf '%.*f', $places + 10, abs($amount); |
|
985 |
my $int_amount = int(abs $amount); |
|
986 |
my $str_places = max(min(10, 16 - length("$int_amount") - $places), $places); |
|
987 |
my $amount_str = sprintf '%.*f', $places + $str_places, abs($amount); |
|
986 | 988 |
|
987 | 989 |
return $amount unless $amount_str =~ m{^(\d+)\.(\d+)$}; |
988 | 990 |
|
Auch abrufbar als: Unified diff
round_amount: Anzahl Stellen nicht zu hoch werden lassen