summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--bcc32/Makefile.sub5
-rw-r--r--numeric.c7
-rw-r--r--win32/Makefile.sub8
-rw-r--r--win32/win32.h30
5 files changed, 32 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 785f92f..b3b8ed5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 ca63aa8..05fbd59 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
diff --git a/numeric.c b/numeric.c
index e77c09f..8a76b8f 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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 c358e3b..b38087f 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 b378fb2..48d2f1b 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__