summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-20 17:01:30 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-20 17:01:30 +0000
commitf83c5da39d1339f8d3ab00be0b214fc65cd69f44 (patch)
tree9ea99e238bb6bd42ebb923415696512ee85a4123 /sprintf.c
parent3c59330bfea992d86df30aed2181a75ad37aafeb (diff)
* 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
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sprintf.c b/sprintf.c
index 69f9fa3ff3..caea4c587f 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -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;
}