PennMUSH Community

Changeset 1017

Show
Ignore:
Timestamp:
07/07/07 22:06:23 (1 year ago)
Author:
shawnw
Message:

Use isnormal() for nan/inf checking when available.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/CHANGES.182

    r1001 r1017  
    2929  * Fixed handling of telnet NOPs sent by clients. [SW] 
    3030  * The OpenSSL random number pool wasn't getting adequately 
    31     initialized on systems without /dev/urandom 
     31    initialized on systems without /dev/urandom [SW] 
     32  * Infinite loop in math code. Reported by Ashen-Sugar. [GM] 
    3233 
    3334Version 1.8.2 patchlevel 5                      June 13, 2007 
  • 1.8.3/branches/devel/config.h.in

    r974 r1017  
    168168#undef HAS_CRYPT 
    169169 
    170 #undef HAS_FPSETMASK 
    171  
    172 #undef HAS_FPSETROUND 
     170#undef HAVE_FPSETMASK 
     171 
     172#undef HAVE_FPSETROUND 
     173 
     174#undef HAVE_ISNORMAL 
    173175 
    174176#undef HAS_GAI_STRERROR 
  • 1.8.3/branches/devel/configure

    r974 r1017  
    1383713837fi 
    1383813838 
    13839 { echo "$as_me:$LINENO: checking for fpsetmask" >&5 
    13840 echo $ECHO_N "checking for fpsetmask... $ECHO_C" >&6; } 
    13841 if test "${ac_cv_func_fpsetmask+set}" = set; then 
     13839 
     13840 
     13841for ac_func in fpsetmask fpsetround 
     13842do 
     13843as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` 
     13844{ echo "$as_me:$LINENO: checking for $ac_func" >&5 
     13845echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } 
     13846if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then 
    1384213847  echo $ECHO_N "(cached) $ECHO_C" >&6 
    1384313848else 
     
    1384813853cat >>conftest.$ac_ext <<_ACEOF 
    1384913854/* end confdefs.h.  */ 
    13850 /* Define fpsetmask to an innocuous variant, in case <limits.h> declares fpsetmask
     13855/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func
    1385113856   For example, HP-UX 11i <limits.h> declares gettimeofday.  */ 
    13852 #define fpsetmask innocuous_fpsetmask 
     13857#define $ac_func innocuous_$ac_func 
    1385313858 
    1385413859/* System header to define __stub macros and hopefully few prototypes, 
    13855     which can conflict with char fpsetmask (); below. 
     13860    which can conflict with char $ac_func (); below. 
    1385613861    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since 
    1385713862    <limits.h> exists even on freestanding compilers.  */ 
     
    1386313868#endif 
    1386413869 
    13865 #undef fpsetmask 
     13870#undef $ac_func 
    1386613871 
    1386713872/* Override any GCC internal prototype to avoid an error. 
     
    1387113876extern "C" 
    1387213877#endif 
    13873 char fpsetmask (); 
     13878char $ac_func (); 
    1387413879/* The GNU C library defines this for functions which it implements 
    1387513880    to always fail with ENOSYS.  Some functions are actually named 
    1387613881    something starting with __ and the normal name is an alias.  */ 
    13877 #if defined __stub_fpsetmask || defined __stub___fpsetmask 
     13882#if defined __stub_$ac_func || defined __stub___$ac_func 
    1387813883choke me 
    1387913884#endif 
     
    1388213887main () 
    1388313888{ 
    13884 return fpsetmask (); 
     13889return $ac_func (); 
    1388513890  ; 
    1388613891  return 0; 
     
    1392113926  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    1392213927  (exit $ac_status); }; }; then 
    13923   ac_cv_func_fpsetmask=yes 
     13928  eval "$as_ac_var=yes" 
    1392413929else 
    1392513930  echo "$as_me: failed program was:" >&5 
    1392613931sed 's/^/| /' conftest.$ac_ext >&5 
    1392713932 
    13928     ac_cv_func_fpsetmask=no 
     13933    eval "$as_ac_var=no" 
    1392913934fi 
    1393013935 
     
    1393213937      conftest$ac_exeext conftest.$ac_ext 
    1393313938fi 
    13934 { echo "$as_me:$LINENO: result: $ac_cv_func_fpsetmask" >&5 
    13935 echo "${ECHO_T}$ac_cv_func_fpsetmask" >&6; } 
    13936 if test $ac_cv_func_fpsetmask = yes; then 
    13937   cat >>confdefs.h <<\_ACEOF 
    13938 #define HAS_FPSETMASK 1 
    13939 _ACEOF 
    13940  
    13941 fi 
    13942  
    13943 { echo "$as_me:$LINENO: checking for fpsetround" >&5 
    13944 echo $ECHO_N "checking for fpsetround... $ECHO_C" >&6; } 
    13945 if test "${ac_cv_func_fpsetround+set}" = set; then 
    13946   echo $ECHO_N "(cached) $ECHO_C" >&6 
    13947 else 
    13948   cat >conftest.$ac_ext <<_ACEOF 
    13949 /* confdefs.h.  */ 
    13950 _ACEOF 
    13951 cat confdefs.h >>conftest.$ac_ext 
    13952 cat >>conftest.$ac_ext <<_ACEOF 
    13953 /* end confdefs.h.  */ 
    13954 /* Define fpsetround to an innocuous variant, in case <limits.h> declares fpsetround. 
    13955    For example, HP-UX 11i <limits.h> declares gettimeofday.  */ 
    13956 #define fpsetround innocuous_fpsetround 
    13957  
    13958 /* System header to define __stub macros and hopefully few prototypes, 
    13959     which can conflict with char fpsetround (); below. 
    13960     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since 
    13961     <limits.h> exists even on freestanding compilers.  */ 
    13962  
    13963 #ifdef __STDC__ 
    13964 # include <limits.h> 
    13965 #else 
    13966 # include <assert.h> 
    13967 #endif 
    13968  
    13969 #undef fpsetround 
    13970  
    13971 /* Override any GCC internal prototype to avoid an error. 
    13972    Use char because int might match the return type of a GCC 
    13973    builtin and then its argument prototype would still apply.  */ 
    13974 #ifdef __cplusplus 
    13975 extern "C" 
    13976 #endif 
    13977 char fpsetround (); 
    13978 /* The GNU C library defines this for functions which it implements 
    13979     to always fail with ENOSYS.  Some functions are actually named 
    13980     something starting with __ and the normal name is an alias.  */ 
    13981 #if defined __stub_fpsetround || defined __stub___fpsetround 
    13982 choke me 
    13983 #endif 
    13984  
    13985 int 
    13986 main () 
    13987 
    13988 return fpsetround (); 
    13989   ; 
    13990   return 0; 
     13939ac_res=`eval echo '${'$as_ac_var'}'` 
     13940           { echo "$as_me:$LINENO: result: $ac_res" >&5 
     13941echo "${ECHO_T}$ac_res" >&6; } 
     13942if test `eval echo '${'$as_ac_var'}'` = yes; then 
     13943  cat >>confdefs.h <<_ACEOF 
     13944#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 
     13945_ACEOF 
     13946 
     13947fi 
     13948done 
     13949 
     13950{ echo "$as_me:$LINENO: checking for isnormal" >&5 
     13951echo $ECHO_N "checking for isnormal... $ECHO_C" >&6; } 
     13952cat >conftest.$ac_ext <<_ACEOF 
     13953 
     13954#include <math.h> 
     13955int main(void) { 
     13956 return !isnormal(1.0); 
    1399113957} 
    13992 _ACEOF 
    13993 rm -f conftest.$ac_objext conftest$ac_exeext 
    13994 if { (ac_try="$ac_link" 
     13958 
     13959_ACEOF 
     13960rm -f conftest.$ac_objext 
     13961if { (ac_try="$ac_compile" 
    1399513962case "(($ac_try" in 
    1399613963  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     
    1399813965esac 
    1399913966eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
    14000   (eval "$ac_link") 2>conftest.er1 
     13967  (eval "$ac_compile") 2>conftest.er1 
    1400113968  ac_status=$? 
    1400213969  grep -v '^ *+' conftest.er1 >conftest.err 
     
    1401513982  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    1401613983  (exit $ac_status); }; } && 
    14017      { ac_try='test -s conftest$ac_exeext' 
     13984     { ac_try='test -s conftest.$ac_objext' 
    1401813985  { (case "(($ac_try" in 
    1401913986  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     
    1402513992  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    1402613993  (exit $ac_status); }; }; then 
    14027   ac_cv_func_fpsetround=yes 
     13994  { echo "$as_me:$LINENO: result: yes" >&5 
     13995echo "${ECHO_T}yes" >&6; } 
     13996cat >>confdefs.h <<\_ACEOF 
     13997#define HAVE_ISNORMAL 1 
     13998_ACEOF 
     13999 
    1402814000else 
    1402914001  echo "$as_me: failed program was:" >&5 
    1403014002sed 's/^/| /' conftest.$ac_ext >&5 
    1403114003 
    14032     ac_cv_func_fpsetround=no 
    14033 fi 
    14034  
    14035 rm -f core conftest.err conftest.$ac_objext \ 
    14036       conftest$ac_exeext conftest.$ac_ext 
    14037 fi 
    14038 { echo "$as_me:$LINENO: result: $ac_cv_func_fpsetround" >&5 
    14039 echo "${ECHO_T}$ac_cv_func_fpsetround" >&6; } 
    14040 if test $ac_cv_func_fpsetround = yes; then 
    14041   cat >>confdefs.h <<\_ACEOF 
    14042 #define HAS_FPSETROUND 1 
    14043 _ACEOF 
    14044  
    14045 fi 
     14004    { echo "$as_me:$LINENO: result: no" >&5 
     14005echo "${ECHO_T}no" >&6; } 
     14006fi 
     14007 
     14008rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
    1404614009 
    1404714010{ echo "$as_me:$LINENO: checking for gai_strerror" >&5 
     
    1736917332done 
    1737017333 
    17371 { echo "$as_me:$LINENO: checking checking for union wait" >&5 
    17372 echo $ECHO_N "checking checking for union wait... $ECHO_C" >&6; } 
     17334{ echo "$as_me:$LINENO: checking for union wait" >&5 
     17335echo $ECHO_N "checking for union wait... $ECHO_C" >&6; } 
    1737317336{ echo "$as_me:$LINENO: checking for union wait" >&5 
    1737417337echo $ECHO_N "checking for union wait... $ECHO_C" >&6; } 
  • 1.8.3/branches/devel/configure.in

    r974 r1017  
    161161AC_CHECK_FUNC(bindtextdomain, [AC_DEFINE(HAS_BINDTEXTDOMAIN)]) 
    162162AC_CHECK_FUNC(crypt, [AC_DEFINE(HAS_CRYPT)]) 
    163 AC_CHECK_FUNC(fpsetmask, [AC_DEFINE(HAS_FPSETMASK)]) 
    164 AC_CHECK_FUNC(fpsetround, [AC_DEFINE(HAS_FPSETROUND)]) 
     163AC_CHECK_FUNCS([fpsetmask fpsetround]) 
     164AC_MSG_CHECKING([for isnormal]) 
     165AC_COMPILE_IFELSE([ 
     166#include <math.h> 
     167int main(void) { 
     168 return !isnormal(1.0); 
     169
     170],  
     171[AC_MSG_RESULT(yes)] 
     172[AC_DEFINE(HAVE_ISNORMAL)], 
     173AC_MSG_RESULT(no)) 
     174 
    165175AC_CHECK_FUNC(gai_strerror, [AC_DEFINE(HAS_GAI_STRERROR)]) 
    166176AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE(HAS_GETADDRINFO)]) 
     
    203213 
    204214AC_CHECK_FUNCS([wait3 wait]) 
    205 AC_MSG_CHECKING(checking for union wait
     215AC_MSG_CHECKING([for union wait]
    206216AC_CHECK_TYPES([union wait], [AC_DEFINE(UNION_WAIT) 
    207217 AC_MSG_RESULT(yes)], AC_MSG_RESULT(no), 
     
    231241 
    232242# Will toupper()ing an already uppercase character be a problem? 
    233 AC_MSG_CHECKING(if it is safe to toupper uppers
     243AC_MSG_CHECKING([if it is safe to toupper uppers]
    234244AC_TRY_COMPILE( 
    235245[#include <ctype.h>], 
  • 1.8.3/branches/devel/hdrs/externs.h

    r1007 r1017  
    332332bool is_strict_number(const char *str); 
    333333bool is_strict_integer(const char *str); 
     334#ifdef HAVE_ISNORMAL 
     335#define is_good_number(n) isnormal((n)) 
     336#else 
    334337bool is_good_number(NVAL val); 
     338#endif 
    335339 
    336340/* From plyrlist.c */ 
  • 1.8.3/branches/devel/src/bsd.c

    r998 r1017  
    513513#endif 
    514514 
    515   /* These are FreeBSDisms to fix floating point exceptions */ 
    516 #ifdef HAS_FPSETROUND 
     515  /* These are BSDisms to fix floating point exceptions */ 
     516#ifdef HAVE_FPSETROUND 
    517517  fpsetround(FP_RN); 
    518518#endif 
    519 #ifdef HAS_FPSETMASK 
     519#ifdef HAVE_FPSETMASK 
    520520  fpsetmask(0L); 
    521521#endif 
  • 1.8.3/branches/devel/src/parse.c

    r1007 r1017  
    353353} 
    354354 
     355#ifndef HAVE_ISNORMAL 
    355356/** Is string a number that isn't inf or nan? 
     357 * Only needed for systems without isnormal() 
    356358 * \param num NVAL 
    357359 * \retval 1 num is a good number. 
     
    373375  return 1; 
    374376} 
     377#endif 
    375378 
    376379/** Is string an integer by the strict definition?