Skip to content

Commit 71e0bb9

Browse files
committed
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@3708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 3819849 commit 71e0bb9

File tree

5 files changed

+32
-28
lines changed

5 files changed

+32
-28
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Mon Apr 21 21:25:59 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
2+
3+
* numeric.c (flo_is_finite_p): use finite() if available.
4+
5+
* win32/win32.h (isinf, isnan): define as macro.
6+
[ruby-win32:00533]
7+
8+
* bcc32/Makefile.sub, win32/Makefile.sub: no longer use
9+
missing/isinf.c, missing/isnan.c.
10+
111
Mon Apr 21 18:36:28 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
212

313
* bignum.c (rb_cstr_to_inum): unnecessarily long buffer was used

bcc32/Makefile.sub

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ RFLAGS = $(iconinc)
102102
EXTLIBS =
103103
!endif
104104
LIBS = cw32.lib import32.lib ws2_32.lib $(EXTLIBS)
105-
MISSING = acosh.obj crypt.obj win32.obj isinf.obj
105+
MISSING = acosh.obj crypt.obj win32.obj
106106

107107
!ifndef STACK
108108
STACK = 0x2000000
@@ -270,6 +270,7 @@ config.h:
270270
\#define SIZEOF_DOUBLE 8
271271

272272
\#define HAVE_DECL_SYS_NERR 1
273+
\#define HAVE_ISINF 1
273274
\#define HAVE_ISNAN 1
274275
\#define HAVE_MEMMOVE 1
275276
\#define HAVE_MKDIR 1
@@ -518,8 +519,6 @@ crypt.obj: crypt.c win32.h
518519
dup2.obj: dup2.c win32.h
519520
finite.obj: finite.c win32.h
520521
flock.obj: flock.c win32.h
521-
isinf.obj: isinf.c win32.h
522-
isnan.obj: isnan.c win32.h
523522
memcmp.obj: memcmp.c win32.h
524523
memmove.obj: memmove.c win32.h
525524
mkdir.obj: mkdir.c win32.h

numeric.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,14 @@ flo_is_finite_p(num)
758758
{
759759
double value = RFLOAT(num)->value;
760760

761+
#if HAVE_FINITE
762+
if (!finite(value))
763+
return Qfalse;
764+
#else
761765
if (isinf(value) || isnan(value))
762766
return Qfalse;
763-
767+
#endif
768+
764769
return Qtrue;
765770
}
766771

win32/Makefile.sub

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ RFLAGS = -r
9393
EXTLIBS =
9494
!endif
9595
LIBS = oldnames.lib user32.lib advapi32.lib wsock32.lib $(EXTLIBS)
96-
MISSING = acosh.obj crypt.obj win32.obj isinf.obj isnan.obj
96+
MISSING = acosh.obj crypt.obj win32.obj
9797

9898
ARFLAGS = -machine:$(MACHINE) -out:
9999
CC = $(CC) -nologo
@@ -245,6 +245,8 @@ config.h:
245245
#define HAVE_STRTOUL 1
246246
#define HAVE_FLOCK 1
247247
#define HAVE_VSNPRINTF 1
248+
#define HAVE_ISINF 1
249+
#define HAVE_ISNAN 1
248250
#define HAVE_FINITE 1
249251
#define HAVE_FMOD 1
250252
#define HAVE_FREXP 1
@@ -328,7 +330,7 @@ s,@AR@,$(AR),;t t
328330
s,@ARFLAGS@,$(ARFLAGS),;t t
329331
s,@LN_S@,$(LN_S),;t t
330332
s,@SET_MAKE@,$(SET_MAKE),;t t
331-
s,@LIBOBJS@, acosh.obj crypt.obj win32.obj isinf.obj isnan.obj,;t t
333+
s,@LIBOBJS@, acosh.obj crypt.obj win32.obj,;t t
332334
s,@ALLOCA@,$(ALLOCA),;t t
333335
s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t
334336
s,@EXEEXT@,.exe,;t t
@@ -516,8 +518,6 @@ crypt.obj: {$(srcdir)}missing/crypt.c
516518
dup2.obj: {$(srcdir)}missing/dup2.c
517519
finite.obj: {$(srcdir)}missing/finite.c
518520
flock.obj: {$(srcdir)}missing/flock.c
519-
isinf.obj: {$(srcdir)}missing/isinf.c
520-
isnan.obj: {$(srcdir)}missing/isnan.c
521521
memcmp.obj: {$(srcdir)}missing/memcmp.c
522522
memmove.obj: {$(srcdir)}missing/memmove.c
523523
mkdir.obj: {$(srcdir)}missing/mkdir.c

win32/win32.h

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -175,40 +175,30 @@ extern int do_aspawn(int, char *, char **);
175175
extern int kill(int, int);
176176
extern pid_t rb_w32_getpid(void);
177177

178-
#ifdef __BORLANDC__
179178
#include <float.h>
179+
#if !defined __MINGW32__ || defined __NO_ISOCEXT
180180
#ifndef isnan
181-
#define isnan _isnan
181+
#define isnan(x) _isnan(x)
182182
#endif
183-
184-
#ifdef S_ISDIR
185-
#undef S_ISDIR
183+
#ifndef isinf
184+
#define isinf(x) (!_finite(x) && !_isnan(x))
186185
#endif
187-
188-
#ifdef S_ISFIFO
189-
#undef S_ISFIFO
186+
#ifndef finite
187+
#define finite(x) _finite(x)
190188
#endif
191-
192-
#ifdef S_ISBLK
193-
#undef S_ISBLK
194189
#endif
195190

196-
#ifdef S_ISCHR
191+
#ifdef __BORLANDC__
192+
#undef S_ISDIR
193+
#undef S_ISFIFO
194+
#undef S_ISBLK
197195
#undef S_ISCHR
198-
#endif
199-
200-
#ifdef S_ISREG
201196
#undef S_ISREG
202-
#endif
203-
204197
#define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR)
205198
#define S_ISFIFO(m) (((unsigned short)(m) & S_IFMT) == S_IFIFO)
206199
#define S_ISBLK(m) (((unsigned short)(m) & S_IFMT) == S_IFBLK)
207200
#define S_ISCHR(m) (((unsigned short)(m) & S_IFMT) == S_IFCHR)
208201
#define S_ISREG(m) (((unsigned short)(m) & S_IFMT) == S_IFREG)
209-
#elif !defined __MINGW32__ || defined __NO_ISOCEXT
210-
extern int isinf(double);
211-
extern int isnan(double);
212202
#endif
213203

214204
#if !defined S_IRUSR && !defined __MINGW32__

0 commit comments

Comments
 (0)