わたなべです.

SUGAI Norihiko <sugai / coss.telcom.oki.co.jp> writes:

:$ ruby -e 'printf("%02x\n",1.0)'
:(d:\usr\local\bin\ruby.exe 1041) Exception: STATUS_ACCESS_VIOLATION
:/tmp/rb001041:1: [BUG] Segmentation fault
:bash.exe: [1001: 1] tcsetattr: Not a character device
:Aborted

Exception: は CYGWIN DLL が出してます.
とりあえずは
$ ruby -e 'printf("%02x\n",1.0.to_i)'
01
としましょう.


--- sprintf.c.orig Fri Jul 24 13:32:51 1998 +++ sprintf.c Fri Aug 28 10:42:32 1998 @@ -328,2 +328,3 @@ int len, pos; + double f; @@ -358,4 +359,10 @@ case T_FLOAT: - val = dbl2big(RFLOAT(val)->value); - bignum = 1; + f = RFLOAT(val)->value; + if (!FIXABLE(f)) { + val = dbl2big(f); + bignum = 1; + } + else { + v = f; + } break;