ruby-changes:8937
From: tadf <ko1@a...>
Date: Thu, 4 Dec 2008 01:28:36 +0900 (JST)
Subject: [ruby-changes:8937] Ruby:r20473 (trunk): * complex.c (f_signbit): NaN may be signed value.
tadf 2008-12-04 01:28:17 +0900 (Thu, 04 Dec 2008) New Revision: 20473 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20473 Log: * complex.c (f_signbit): NaN may be signed value. Modified files: trunk/ChangeLog trunk/complex.c Index: complex.c =================================================================== --- complex.c (revision 20472) +++ complex.c (revision 20473) @@ -887,15 +887,17 @@ switch (TYPE(x)) { case T_FLOAT: #ifdef HAVE_SIGNBIT - return f_boolcast(signbit(RFLOAT_VALUE(x))); + { + double f = RFLOAT_VALUE(x); + return f_boolcast(!isnan(f) && signbit(f)); + } #else - { - char s[2]; + { + char s[2]; - (void)snprintf(s, sizeof s, "%.0f", RFLOAT_VALUE(x)); - - return f_boolcast(s[0] == '-'); - } + (void)snprintf(s, sizeof s, "%.0f", RFLOAT_VALUE(x)); + return f_boolcast(s[0] == '-'); + } #endif } return f_negative_p(x); Index: ChangeLog =================================================================== --- ChangeLog (revision 20472) +++ ChangeLog (revision 20473) @@ -1,3 +1,7 @@ +Thu Dec 4 01:22:41 2008 Tadayoshi Funaba <tadf@d...> + + * complex.c (f_signbit): NaN may be signed value. + Wed Dec 3 23:59:32 2008 Tanaka Akira <akr@f...> * process.c (EXEC_OPTION_DUP2_CHILD): defined. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/