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

numeric.c: isfinite

* numeric.c (flo_is_finite_p): prefer C99 standard isfinite() than
  deprecated finite().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-01-05 12:33:42 +00:00
parent 368aa6e3d5
commit 006e66b668
2 changed files with 7 additions and 2 deletions

View file

@ -1883,6 +1883,7 @@ AC_CHECK_FUNCS(gettimeofday) # for making ac_cv_func_gettimeofday
AC_CHECK_FUNCS(gmtime_r)
AC_CHECK_FUNCS(initgroups)
AC_CHECK_FUNCS(ioctl)
AC_CHECK_FUNCS(isfinite)
AC_CHECK_FUNCS(issetugid)
AC_CHECK_FUNCS(killpg)
AC_CHECK_FUNCS(lchmod)

View file

@ -30,8 +30,12 @@
#include <ieeefp.h>
#endif
#if !defined HAVE_ISFINITE && !defined isfinite
#if defined HAVE_FINITE && !defined finite && !defined _WIN32
extern int finite(double);
# define HAVE_ISFINITE 1
# define isfinite(x) finite(x)
#endif
#endif
/* use IEEE 64bit values if not defined */
@ -1457,8 +1461,8 @@ flo_is_finite_p(VALUE num)
{
double value = RFLOAT_VALUE(num);
#if HAVE_FINITE
if (!finite(value))
#if HAVE_ISFINITE
if (!isfinite(value))
return Qfalse;
#else
if (isinf(value) || isnan(value))