summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-21 08:04:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-21 08:04:11 +0000
commitdf896a05608e4041c36488c60218f06ca74830b9 (patch)
treea2a849b9e6f891febceafd19f20d4a06f38f85d5 /bignum.c
parente6e5674156079ddd466e216593c2eb2da5590944 (diff)
* bignum.c (rb_big2str0): round up for the most significant digit.
[ruby-core:10686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bignum.c b/bignum.c
index f0c3a0f63a..aec25c13d9 100644
--- a/bignum.c
+++ b/bignum.c
@@ -601,10 +601,10 @@ rb_big2str0(VALUE x, int base, int trim)
j = j * 53L / 84 + 1;
break;
case 4: case 5: case 6: case 7:
- j /= 2;
+ j = (j + 1) / 2;
break;
case 8: case 9:
- j /= 3;
+ j = (j + 2) / 3;
break;
case 10: case 11: case 12: case 13: case 14: case 15:
j = j * 28L / 93 + 1;
@@ -612,10 +612,10 @@ rb_big2str0(VALUE x, int base, int trim)
case 16: case 17: case 18: case 19: case 20: case 21:
case 22: case 23: case 24: case 25: case 26: case 27:
case 28: case 29: case 30: case 31:
- j /= 4;
+ j = (j + 3) / 4;
break;
case 32: case 33: case 34: case 35: case 36:
- j /= 5;
+ j = (j + 4) / 5;
break;
default:
rb_raise(rb_eArgError, "illegal radix %d", base);