X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=c59669c41a77a075a8fe873f3e84b2783edbeaee;hb=bebca3b60f8c019b9acbc436da7437d67dc19e67;hp=35b21d5a291cace26da7d823eb8456324b74882d;hpb=bf19eeda5d339c95bde5334727bd9a6802375a8d;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 35b21d5a2..c59669c41 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -982,7 +982,9 @@ sub round_amount { # part. If an overflow occurs then apply that overflow to the part # before the decimal sign as well using integer arithmetic again. - my $amount_str = sprintf '%.*f', $places + 10, abs($amount); + my $int_amount = int(abs $amount); + my $str_places = max(min(10, 16 - length("$int_amount") - $places), $places); + my $amount_str = sprintf '%.*f', $places + $str_places, abs($amount); return $amount unless $amount_str =~ m{^(\d+)\.(\d+)$};