Branch: Tag:

2001-05-28

2001-05-28 18:15:07 by Marcus Comstedt <marcus@mc.pp.se>

Added two methods for generating NaN, infnan() (BSD 4.3) and nan() (C99).

Rev: src/acconfig.h:1.86
Rev: src/configure.in:1.521
Rev: src/opcodes.c:1.108

5:   \*/   /**/   #include "global.h" + #include <errno.h>   #include <math.h>   #include <ctype.h>   #include "interpret.h"
26:   #include "bignum.h"   #include "operators.h"    - RCSID("$Id: opcodes.c,v 1.107 2001/05/15 04:33:58 hubbe Exp $"); + RCSID("$Id: opcodes.c,v 1.108 2001/05/28 18:15:07 marcus Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {
881:    if(e>=9999)    if(f||extra_f) {    /* NAN */ -  -  /* Hmm... No idea how to generate NaN in a portable way. */ -  /* Let's turn it into a 0 for now... */ + #ifdef HAVE_INFNAN +  return (FLOAT_TYPE)infnan(EDOM); + #else + #ifdef HAVE_NAN +  /* C99 provides a portable way of generating NaN */ +  return (FLOAT_TYPE)nan(""); + #else    return (FLOAT_TYPE)0.0; -  + #endif /* HAVE_NAN */ + #endif /* HAVE_INFNAN */    } else {    /* +/- Infinity */ -  + #ifdef HAVE_INFNAN +  return (FLOAT_TYPE)infnan(s? -ERANGE:ERANGE); + #else   #ifdef HUGE_VAL    return (FLOAT_TYPE)(s? -HUGE_VAL:HUGE_VAL);   #else
894:    e = 1024;    f = 1;    extra_f = 0; - #endif + #endif /* HUGE_VAL */ + #endif /* HAVE_INFNAN */    }       r = (double)f;