1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* complex.c (f_signbit): regard NaN as a positive value.

[ruby-dev:37861].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2009-02-02 03:45:28 +00:00
parent ce720ca0dc
commit a98cbcbf0b
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Mon Feb 2 12:41:52 2009 Shugo Maeda <shugo@ruby-lang.org>
* complex.c (f_signbit): regard NaN as a positive value.
[ruby-dev:37861].
Mon Feb 2 12:39:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sample/test.rb (valid_syntax?), test/ruby/test_system.rb

View file

@ -894,8 +894,10 @@ f_signbit(VALUE x)
#else
{
char s[2];
double f = RFLOAT_VALUE(x);
(void)snprintf(s, sizeof s, "%.0f", RFLOAT_VALUE(x));
if (isnan(f)) return Qfalse;
(void)snprintf(s, sizeof s, "%.0f", f);
return f_boolcast(s[0] == '-');
}
#endif