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): remove condition for signbit because

all platforms have signbit from r26871.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-03-12 00:45:06 +00:00
parent 772acb9f1d
commit 27f953bfad
2 changed files with 5 additions and 15 deletions

View file

@ -1,3 +1,8 @@
Fri Mar 12 09:43:11 2010 NARUSE, Yui <naruse@ruby-lang.org>
* complex.c (f_signbit): remove condition for signbit because
all platforms have signbit from r26871.
Fri Mar 12 07:25:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Mar 12 07:25:16 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (init_env): get rid of alloca() for outer string. * win32/win32.c (init_env): get rid of alloca() for outer string.

View file

@ -1154,28 +1154,13 @@ nucomp_eql_p(VALUE self, VALUE other)
return Qfalse; return Qfalse;
} }
#ifndef HAVE_SIGNBIT
#ifdef signbit
#define HAVE_SIGNBIT 1
#endif
#endif
inline static VALUE inline static VALUE
f_signbit(VALUE x) f_signbit(VALUE x)
{ {
switch (TYPE(x)) { switch (TYPE(x)) {
case T_FLOAT: { case T_FLOAT: {
#ifdef HAVE_SIGNBIT
double f = RFLOAT_VALUE(x); double f = RFLOAT_VALUE(x);
return f_boolcast(!isnan(f) && signbit(f)); return f_boolcast(!isnan(f) && signbit(f));
#else
char s[2];
double f = RFLOAT_VALUE(x);
if (isnan(f)) return Qfalse;
(void)snprintf(s, sizeof s, "%.0f", f);
return f_boolcast(s[0] == '-');
#endif
} }
} }
return f_negative_p(x); return f_negative_p(x);