ruby-changes:4226
From: ko1@a...
Date: Thu, 6 Mar 2008 15:44:55 +0900 (JST)
Subject: [ruby-changes:4226] usa - Ruby:r15716 (trunk): * sprintf.c (rb_str_format): casting double to long is undefined
usa 2008-03-06 15:44:41 +0900 (Thu, 06 Mar 2008) New Revision: 15716 Modified files: trunk/ChangeLog trunk/sprintf.c Log: * sprintf.c (rb_str_format): casting double to long is undefined if the interger part of double is out of the range of long. (fix previous commit). http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15716&r2=15715&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sprintf.c?r1=15716&r2=15715&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15715) +++ ChangeLog (revision 15716) @@ -1,4 +1,4 @@ -Thu Mar 6 15:16:55 2008 NAKAMURA Usaku <usa@r...> +Thu Mar 6 15:44:20 2008 NAKAMURA Usaku <usa@r...> * sprintf.c (rb_str_format): casting double to long is undefined if the interger part of double is out of the range of long. Index: sprintf.c =================================================================== --- sprintf.c (revision 15715) +++ sprintf.c (revision 15716) @@ -540,8 +540,7 @@ bin_retry: switch (TYPE(val)) { case T_FLOAT: - if (RFLOAT_VALUE(val) <= LONG_MAX && - RFLOAT_VALUE(val) >= LONG_MIN) { + if (FIXABLE(RFLOAT_VALUE(val))) { val = LONG2FIX((long)RFLOAT_VALUE(val)); goto bin_retry; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/