summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-08 02:26:40 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-08 02:26:40 +0000
commit668cdc36f990de3cac48c8b8f1c1fa2770fe9899 (patch)
treeeb28d9a7e7ff1d9aa5cb9c965140c1027a6c23c6
parent7880a81ab3e4d95702c8212f0b9a6af0ca693b61 (diff)
downloadruby-668cdc36f990de3cac48c8b8f1c1fa2770fe9899.tar.gz
ruby-668cdc36f990de3cac48c8b8f1c1fa2770fe9899.tar.xz
ruby-668cdc36f990de3cac48c8b8f1c1fa2770fe9899.zip
* bignum.c (rb_big2str0): should preserve sign mark.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f855d4ad7..15f8c9d32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Aug 8 11:25:25 2007 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bignum.c (rb_big2str0): should preserve sign mark.
+
Wed Aug 8 11:02:43 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (btest-miniruby, test-sample): split the test target
diff --git a/bignum.c b/bignum.c
index 15a5417a0..7aed3af8a 100644
--- a/bignum.c
+++ b/bignum.c
@@ -867,15 +867,15 @@ rb_big2str0(VALUE x, int base, int trim)
#if SIZEOF_BDIGITS > 2
hbase *= hbase;
#endif
- off = !RTEST(trim) && !RBIGNUM(x)->sign;
+ off = !RTEST(trim) || !RBIGNUM(x)->sign;
xx = rb_big_clone(x);
RBIGNUM(xx)->sign = 1;
if (n1 <= KARATSUBA_DIGITS) {
- len = big2str_orig(xx, base, ptr + off, 2*n1, hbase, RTEST(trim));
+ len = off + big2str_orig(xx, base, ptr + off, 2*n1, hbase, RTEST(trim));
}
else {
- len = big2str_karatsuba(xx, base, ptr + off, n1,
- 2*n1, hbase, RTEST(trim));
+ len = off + big2str_karatsuba(xx, base, ptr + off, n1,
+ 2*n1, hbase, RTEST(trim));
}
ptr[len] = '\0';