Skip to content

Commit cd8d6ae

Browse files
author
Douglas Schrag
committed
Do not add condition leading '0' if already present
If precision is sufficient to pad octal with a leading '0', then no additional prefix is needed with the '#' flag.
1 parent bc1b736 commit cd8d6ae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/HLL/sprintf.nqp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ my module sprintf {
418418
my $pre := '0' if $int ne '0' && has_flag($/, 'hash');
419419
if nqp::chars($<precision>) {
420420
$int := '' if $<precision>.made == 0 && $int == 0;
421+
$pre := '' if $<precision>.made > nqp::chars($int);
421422
$int := $pre ~ infix_x('0', intify($<precision>.made) - nqp::chars($int)) ~ $int;
422423
}
423424
else {

0 commit comments

Comments
 (0)