Skip to content

Commit a9cf677

Browse files
committed
Only output trailing dot if there are also trailing digits
1 parent 9b526d1 commit a9cf677

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/HLL/sprintf.nqp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ my module sprintf {
211211
$lhs_s := nqp::tostr_I($lhs_I);
212212
$rhs_s := nqp::substr($rhs_s,1,$precision); # skip the leading char we added.
213213

214-
$lhs_s ~ '.' ~ $rhs_s;
214+
my $return := $lhs_s;
215+
$return := $return ~ "." ~ $rhs_s if $rhs_s ne "";
216+
$return;
215217
}
216218

217219
sub stringify-to-precision2($float, $precision) {

0 commit comments

Comments
 (0)