Detect and use the nan function.

This commit is contained in:
steve 2007-06-13 01:03:57 +00:00
parent 8ec6d9983d
commit e24e77660f
3 changed files with 20 additions and 4 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: config.h.in,v 1.23 2007/02/02 04:33:01 steve Exp $"
#ident "$Id: config.h.in,v 1.24 2007/06/13 01:03:57 steve Exp $"
#endif
#if defined(__cplusplus)
@ -50,6 +50,7 @@
# undef HAVE_READLINE_HISTORY_H
# undef HAVE_INTTYPES_H
# undef HAVE_LROUND
# undef HAVE_NAN
/* Figure if I can use readline. */
#undef USE_READLINE
@ -85,6 +86,8 @@ typedef unsigned long vvp_time64_t;
# endif
#endif
# include <math.h>
/* getrusage, /proc/self/statm */
# undef HAVE_SYS_RESOURCE_H
@ -98,6 +101,13 @@ extern long lround(double x);
#endif
#endif
#if !defined(HAVE_NAN)
# define nan(x) (NAN)
#endif
#if !defined(INFINITY)
# define INFINITY HUGE_VAL
#endif
/*
* When doing dynamic linking, we need a uniform way to identify the
@ -119,6 +129,9 @@ extern long lround(double x);
/*
* $Log: config.h.in,v $
* Revision 1.24 2007/06/13 01:03:57 steve
* Detect and use the nan function.
*
* Revision 1.23 2007/02/02 04:33:01 steve
* Use inttypes.h instead of stdint.h for portability.
*

View File

@ -75,7 +75,7 @@ esac
# Check that these functions exist. They are mostly C99
# functions that older compilers may not yet support.
AC_CHECK_FUNCS(lround)
AC_CHECK_FUNCS(lround nan)
# see how we can give some resource usage stats with -v
# Linux does not provide mem stats in rusage, use /proc/self/statm.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vthread.cc,v 1.165 2007/06/12 02:36:58 steve Exp $"
#ident "$Id: vthread.cc,v 1.166 2007/06/13 01:03:57 steve Exp $"
#endif
# include "config.h"
@ -2207,7 +2207,7 @@ bool of_LOADI_WR(vthread_t thr, vvp_code_t cp)
}
// Detect NaN
if ( (exp&0x3fff) == 0x3fff ) {
thr->words[idx].w_real = NAN;
thr->words[idx].w_real = nan("");
}
double sign = (exp & 0x4000)? -1.0 : 1.0;
@ -3489,6 +3489,9 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.166 2007/06/13 01:03:57 steve
* Detect and use the nan function.
*
* Revision 1.165 2007/06/12 02:36:58 steve
* handle constant inf values.
*