Home | History | Annotate | Download | only in dmg_fp
      1 Index: dtoa.cc
      2 --- dtoa.cc    (old copy)
      3 +++ dtoa.cc    (working copy)
      4 @@ -179,6 +179,9 @@
      5   *	used for input more than STRTOD_DIGLIM digits long (default 40).
      6   */
      7  
      8 +#define IEEE_8087
      9 +#define NO_HEX_FP
     10 +
     11  #ifndef Long
     12  #define Long long
     13  #endif
     14 @@ -280,9 +283,7 @@
     15  #include "math.h"
     16  #endif
     17  
     18 -#ifdef __cplusplus
     19 -extern "C" {
     20 -#endif
     21 +namespace dmg_fp {
     22  
     23  #ifndef CONST
     24  #ifdef KR_headers
     25 @@ -511,11 +512,9 @@
     26  
     27  #define Kmax 7
     28  
     29 -#ifdef __cplusplus
     30 -extern "C" double strtod(const char *s00, char **se);
     31 -extern "C" char *dtoa(double d, int mode, int ndigits,
     32 +double strtod(const char *s00, char **se);
     33 +char *dtoa(double d, int mode, int ndigits,
     34  			int *decpt, int *sign, char **rve);
     35 -#endif
     36  
     37   struct
     38  Bigint {
     39 @@ -1527,7 +1526,7 @@
     40  #ifdef KR_headers
     41  	(sp, t) char **sp, *t;
     42  #else
     43 -	(CONST char **sp, char *t)
     44 +	(CONST char **sp, CONST char *t)
     45  #endif
     46  {
     47  	int c, d;
     48 @@ -2234,7 +2234,7 @@ bigcomp
     49  	nd = bc->nd;
     50  	nd0 = bc->nd0;
     51  	p5 = nd + bc->e0 - 1;
     52 -	speccase = 0;
     53 +	dd = speccase = 0;
     54  #ifndef Sudden_Underflow
     55  	if (rv->d == 0.) {	/* special case: value near underflow-to-zero */
     56  				/* threshold was rounded to zero */
     57 @@ -3431,7 +3430,7 @@
     58  
     59  	j = sizeof(ULong);
     60  	for(k = 0;
     61 -		sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
     62 +		sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
     63  		j <<= 1)
     64  			k++;
     65  	r = (int*)Balloc(k);
     66 @@ -3447,7 +3446,7 @@
     67  #ifdef KR_headers
     68  nrv_alloc(s, rve, n) char *s, **rve; int n;
     69  #else
     70 -nrv_alloc(char *s, char **rve, int n)
     71 +nrv_alloc(CONST char *s, char **rve, int n)
     72  #endif
     73  {
     74  	char *rv, *t;
     75 @@ -4202,6 +4201,5 @@
     76  		*rve = s;
     77  	return s0;
     78  	}
     79 -#ifdef __cplusplus
     80 -}
     81 -#endif
     82 +
     83 +}  // namespace dmg_fp
     84 Index: g_fmt.cc
     85 --- g_fmt.cc   (old copy)
     86 +++ g_fmt.cc   (new copy)
     87 @@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
     88  	if (sign)
     89  		*b++ = '-';
     90  	if (decpt == 9999) /* Infinity or Nan */ {
     91 -		while(*b++ = *s++);
     92 +		while((*b++ = *s++));
     93  		goto done0;
     94  		}
     95  	if (decpt <= -4 || decpt > se - s + 5) {
     96  		*b++ = *s++;
     97  		if (*s) {
     98  			*b++ = '.';
     99 -			while(*b = *s++)
    100 +			while((*b = *s++))
    101  				b++;
    102  			}
    103  		*b++ = 'e';
    104 @@ -79,10 +79,10 @@ g_fmt(register char *b, double x)
    105  		*b++ = '.';
    106  		for(; decpt < 0; decpt++)
    107  			*b++ = '0';
    108 -		while(*b++ = *s++);
    109 +		while((*b++ = *s++));
    110  		}
    111  	else {
    112 -		while(*b = *s++) {
    113 +		while((*b = *s++)) {
    114  			b++;
    115  			if (--decpt == 0 && *s)
    116  				*b++ = '.';
    117 @@ -93,7 +93,9 @@ g_fmt(register char *b, double x)
    118  		}
    119   done0:
    120  	freedtoa(s0);
    121 +#ifdef IGNORE_ZERO_SIGN
    122   done:
    123 +#endif
    124  	return b0;
    125  	}
    126  
    127