>>>>> "t" == ts  <decoux / moulon.inra.fr> writes:

t> moulon% ruby -ve 'puts sprintf("%08b",0),RUBY_VERSION'
t> ruby 1.8.1 (2003-12-25) [sparc-solaris2.7]

 Not really sure (the problem is on line 566 in sprintf.c)

		    if (bignum && !RBIGNUM(val)->sign)
			c = sign_bits(base, p);


moulon% diff -u sprintf.c~ sprintf.c
--- sprintf.c~  Thu Jul  3 13:00:18 2003
+++ sprintf.c   Mon Feb 16 13:40:08 2004
@@ -345,6 +345,7 @@
                long v = 0;
                int base, bignum = 0;
                int len, pos;
+               VALUE tmp;
 
                switch (*p) {
                  case 'd':
@@ -472,8 +473,8 @@
                }
 
                if (sign) {
-                   val = rb_big2str(val, base);
-                   s = RSTRING(val)->ptr;
+                   tmp = rb_big2str(val, base);
+                   s = RSTRING(tmp)->ptr;
                    if (s[0] == '-') {
                        s++;
                        sc = '-';
@@ -493,8 +494,8 @@
                    val = rb_big_clone(val);
                    rb_big_2comp(val);
                }
-               val = rb_big2str(val, base);
-               s = RSTRING(val)->ptr;
+               tmp = rb_big2str(val, base);
+               s = RSTRING(tmp)->ptr;
                if (*s == '-') {
                    if (base == 10) {
                        rb_warning("negative number for %%u specifier");
@@ -502,8 +503,8 @@
                    }
                    else {
                        remove_sign_bits(++s, base);
-                       val = rb_str_new(0, 3+strlen(s));
-                       t = RSTRING(val)->ptr;
+                       tmp = rb_str_new(0, 3+strlen(s));
+                       t = RSTRING(tmp)->ptr;
                        if (!(flags&FPREC)) {
                            strcpy(t, "..");
                            t += 2;
@@ -520,7 +521,7 @@
                        bignum = 2;
                    }
                }
-               s  = RSTRING(val)->ptr;
+               s  = RSTRING(tmp)->ptr;
 
              format_integer:
                pos = -1;
moulon% 


Guy Decoux