Branch: Tag:

2001-08-09

2001-08-09 18:54:15 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

some cleanups for inf/nan etc.

Rev: src/encode.c:1.121

25:   #include "version.h"   #include "bignum.h"    - RCSID("$Id: encode.c,v 1.120 2001/08/09 06:42:38 hubbe Exp $"); + RCSID("$Id: encode.c,v 1.121 2001/08/09 18:54:15 hubbe Exp $");      /* #define ENCODE_DEBUG */   
611:   #define Pike_FP_PINF -1 /* Positive infinity */   #define Pike_FP_ZERO 0 /* Backwards compatible zero */   #define Pike_FP_NZERO 1 /* Negative Zero */ - #define Pike_FP_PZERO 2 /* Positive zero */ + #define Pike_FP_PZERO 0 /* Positive zero */ + #define Pike_FP_UNKNOWN -4711 /* Positive zero */         #ifdef HAVE_FPCLASS
643: Inside #if defined(HAVE_FPCLASS)
      case FP_PZERO:    code_entry(TAG_FLOAT,0,data); -  code_entry(TAG_FLOAT,0,data); /* normal zero */ +  code_entry(TAG_FLOAT,Pike_FP_ZERO,data); /* normal zero */    break;       /* Ugly, but switch gobbles breaks -Hubbe */
655:      #else    { -  int pike_ftype=0; +  int pike_ftype=Pike_FP_UNKNOWN;   #ifdef HAVE_ISINF    if(isinf(val->u.float_number))    pike_ftype=Pike_FP_PINF;
673: Inside #if defined(HAVE_FINITE)
  #endif   #ifdef HAVE_FINITE    if(!finite(val->u.float_number)) -  pike_ftype=Pike_FP_SNAN; +  pike_ftype=Pike_FP_PINF;   #endif    ; /* Terminate any remaining else */   
696:    }    }    -  if(pike_ftype) +  if(pike_ftype != Pike_FP_UNKNOWN)    { -  if(pike_ftype == Pike_FP_PZERO) -  pike_ftype=0; -  +     code_entry(TAG_FLOAT,0,data);    code_entry(TAG_FLOAT,pike_ftype,data);    break;
1776:    switch(num)    {    case Pike_FP_SNAN: /* Signal Not A Number */ +  case Pike_FP_QNAN: /* Quiet Not A Number */    push_float(MAKE_NAN());    break;    -  case Pike_FP_QNAN: /* Quiet Not A Number */ -  push_float(0.0); /* how do you push a qnan? */ -  break; -  +     case Pike_FP_NINF: /* Negative infinity */    push_float(MAKE_INF(-1));    break;