1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sprintf.c (rb_f_sprintf): copy sign bits only if value is

negative.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-03-20 17:01:30 +00:00
parent 3c59330bfe
commit f83c5da39d
2 changed files with 9 additions and 1 deletions

View file

@ -556,7 +556,12 @@ rb_f_sprintf(argc, argv)
}
}
else {
char c = sign_bits(base, p);
char c;
if (bignum && !RBIGNUM(val)->sign)
c = sign_bits(base, p);
else
c = '0';
while (len < prec--) {
buf[blen++] = c;
}