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:
parent
3c59330bfe
commit
f83c5da39d
2 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
|||
Fri Mar 21 01:29:35 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* sprintf.c (rb_f_sprintf): copy sign bits only if value is
|
||||
negative.
|
||||
|
||||
* missing.h: include <stdarg.h> or <varargs.h> if HAVE_VSNPRINTF
|
||||
is not defined.
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue