diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-21 12:26:08 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-21 12:26:08 +0000 |
commit | 2aba86b31801c7a21e5dbd4bac9d837b3b2caad1 (patch) | |
tree | 1cb8b3a6f9623e1714715ac5986c6ac339830f3f | |
parent | f8e5f4371e0820758bf95ff1e65d09bd83218606 (diff) | |
download | ruby-2aba86b31801c7a21e5dbd4bac9d837b3b2caad1.tar.gz ruby-2aba86b31801c7a21e5dbd4bac9d837b3b2caad1.tar.xz ruby-2aba86b31801c7a21e5dbd4bac9d837b3b2caad1.zip |
* numeric.c (flo_is_finite_p): use finite() if available.
* win32/win32.h (isinf, isnan): define as macro.
[ruby-win32:00533]
* bcc32/Makefile.sub, win32/Makefile.sub: no longer use
missing/isinf.c, missing/isnan.c.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | bcc32/Makefile.sub | 5 | ||||
-rw-r--r-- | numeric.c | 7 | ||||
-rw-r--r-- | win32/Makefile.sub | 8 | ||||
-rw-r--r-- | win32/win32.h | 30 |
5 files changed, 32 insertions, 28 deletions
@@ -1,3 +1,13 @@ +Mon Apr 21 21:25:59 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> + + * numeric.c (flo_is_finite_p): use finite() if available. + + * win32/win32.h (isinf, isnan): define as macro. + [ruby-win32:00533] + + * bcc32/Makefile.sub, win32/Makefile.sub: no longer use + missing/isinf.c, missing/isnan.c. + Mon Apr 21 18:36:28 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> * bignum.c (rb_cstr_to_inum): unnecessarily long buffer was used diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub index ca63aa8fc..05fbd59df 100644 --- a/bcc32/Makefile.sub +++ b/bcc32/Makefile.sub @@ -102,7 +102,7 @@ RFLAGS = $(iconinc) EXTLIBS = !endif LIBS = cw32.lib import32.lib ws2_32.lib $(EXTLIBS) -MISSING = acosh.obj crypt.obj win32.obj isinf.obj +MISSING = acosh.obj crypt.obj win32.obj !ifndef STACK STACK = 0x2000000 @@ -270,6 +270,7 @@ config.h: \#define SIZEOF_DOUBLE 8 \#define HAVE_DECL_SYS_NERR 1 +\#define HAVE_ISINF 1 \#define HAVE_ISNAN 1 \#define HAVE_MEMMOVE 1 \#define HAVE_MKDIR 1 @@ -518,8 +519,6 @@ crypt.obj: crypt.c win32.h dup2.obj: dup2.c win32.h finite.obj: finite.c win32.h flock.obj: flock.c win32.h -isinf.obj: isinf.c win32.h -isnan.obj: isnan.c win32.h memcmp.obj: memcmp.c win32.h memmove.obj: memmove.c win32.h mkdir.obj: mkdir.c win32.h @@ -758,9 +758,14 @@ flo_is_finite_p(num) { double value = RFLOAT(num)->value; +#if HAVE_FINITE + if (!finite(value)) + return Qfalse; +#else if (isinf(value) || isnan(value)) return Qfalse; - +#endif + return Qtrue; } diff --git a/win32/Makefile.sub b/win32/Makefile.sub index c358e3b93..b38087f97 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -93,7 +93,7 @@ RFLAGS = -r EXTLIBS = !endif LIBS = oldnames.lib user32.lib advapi32.lib wsock32.lib $(EXTLIBS) -MISSING = acosh.obj crypt.obj win32.obj isinf.obj isnan.obj +MISSING = acosh.obj crypt.obj win32.obj ARFLAGS = -machine:$(MACHINE) -out: CC = $(CC) -nologo @@ -245,6 +245,8 @@ config.h: #define HAVE_STRTOUL 1 #define HAVE_FLOCK 1 #define HAVE_VSNPRINTF 1 +#define HAVE_ISINF 1 +#define HAVE_ISNAN 1 #define HAVE_FINITE 1 #define HAVE_FMOD 1 #define HAVE_FREXP 1 @@ -328,7 +330,7 @@ s,@AR@,$(AR),;t t s,@ARFLAGS@,$(ARFLAGS),;t t s,@LN_S@,$(LN_S),;t t s,@SET_MAKE@,$(SET_MAKE),;t t -s,@LIBOBJS@, acosh.obj crypt.obj win32.obj isinf.obj isnan.obj,;t t +s,@LIBOBJS@, acosh.obj crypt.obj win32.obj,;t t s,@ALLOCA@,$(ALLOCA),;t t s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t s,@EXEEXT@,.exe,;t t @@ -516,8 +518,6 @@ crypt.obj: {$(srcdir)}missing/crypt.c dup2.obj: {$(srcdir)}missing/dup2.c finite.obj: {$(srcdir)}missing/finite.c flock.obj: {$(srcdir)}missing/flock.c -isinf.obj: {$(srcdir)}missing/isinf.c -isnan.obj: {$(srcdir)}missing/isnan.c memcmp.obj: {$(srcdir)}missing/memcmp.c memmove.obj: {$(srcdir)}missing/memmove.c mkdir.obj: {$(srcdir)}missing/mkdir.c diff --git a/win32/win32.h b/win32/win32.h index b378fb23c..48d2f1bea 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -175,40 +175,30 @@ extern int do_aspawn(int, char *, char **); extern int kill(int, int); extern pid_t rb_w32_getpid(void); -#ifdef __BORLANDC__ #include <float.h> +#if !defined __MINGW32__ || defined __NO_ISOCEXT #ifndef isnan -#define isnan _isnan +#define isnan(x) _isnan(x) #endif - -#ifdef S_ISDIR -#undef S_ISDIR +#ifndef isinf +#define isinf(x) (!_finite(x) && !_isnan(x)) #endif - -#ifdef S_ISFIFO -#undef S_ISFIFO +#ifndef finite +#define finite(x) _finite(x) #endif - -#ifdef S_ISBLK -#undef S_ISBLK #endif -#ifdef S_ISCHR +#ifdef __BORLANDC__ +#undef S_ISDIR +#undef S_ISFIFO +#undef S_ISBLK #undef S_ISCHR -#endif - -#ifdef S_ISREG #undef S_ISREG -#endif - #define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR) #define S_ISFIFO(m) (((unsigned short)(m) & S_IFMT) == S_IFIFO) #define S_ISBLK(m) (((unsigned short)(m) & S_IFMT) == S_IFBLK) #define S_ISCHR(m) (((unsigned short)(m) & S_IFMT) == S_IFCHR) #define S_ISREG(m) (((unsigned short)(m) & S_IFMT) == S_IFREG) -#elif !defined __MINGW32__ || defined __NO_ISOCEXT -extern int isinf(double); -extern int isnan(double); #endif #if !defined S_IRUSR && !defined __MINGW32__ |