127 lines
2.5 KiB
Diff
127 lines
2.5 KiB
Diff
Index: dtoa.cc
|
|
--- dtoa.cc (old copy)
|
|
+++ dtoa.cc (working copy)
|
|
@@ -179,6 +179,9 @@
|
|
* used for input more than STRTOD_DIGLIM digits long (default 40).
|
|
*/
|
|
|
|
+#define IEEE_8087
|
|
+#define NO_HEX_FP
|
|
+
|
|
#ifndef Long
|
|
#define Long long
|
|
#endif
|
|
@@ -280,9 +283,7 @@
|
|
#include "math.h"
|
|
#endif
|
|
|
|
-#ifdef __cplusplus
|
|
-extern "C" {
|
|
-#endif
|
|
+namespace dmg_fp {
|
|
|
|
#ifndef CONST
|
|
#ifdef KR_headers
|
|
@@ -511,11 +512,9 @@
|
|
|
|
#define Kmax 7
|
|
|
|
-#ifdef __cplusplus
|
|
-extern "C" double strtod(const char *s00, char **se);
|
|
-extern "C" char *dtoa(double d, int mode, int ndigits,
|
|
+double strtod(const char *s00, char **se);
|
|
+char *dtoa(double d, int mode, int ndigits,
|
|
int *decpt, int *sign, char **rve);
|
|
-#endif
|
|
|
|
struct
|
|
Bigint {
|
|
@@ -1527,7 +1526,7 @@
|
|
#ifdef KR_headers
|
|
(sp, t) char **sp, *t;
|
|
#else
|
|
- (CONST char **sp, char *t)
|
|
+ (CONST char **sp, CONST char *t)
|
|
#endif
|
|
{
|
|
int c, d;
|
|
@@ -2234,7 +2234,7 @@ bigcomp
|
|
nd = bc->nd;
|
|
nd0 = bc->nd0;
|
|
p5 = nd + bc->e0 - 1;
|
|
- speccase = 0;
|
|
+ dd = speccase = 0;
|
|
#ifndef Sudden_Underflow
|
|
if (rv->d == 0.) { /* special case: value near underflow-to-zero */
|
|
/* threshold was rounded to zero */
|
|
@@ -3431,7 +3430,7 @@
|
|
|
|
j = sizeof(ULong);
|
|
for(k = 0;
|
|
- sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
|
|
+ sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
|
|
j <<= 1)
|
|
k++;
|
|
r = (int*)Balloc(k);
|
|
@@ -3447,7 +3446,7 @@
|
|
#ifdef KR_headers
|
|
nrv_alloc(s, rve, n) char *s, **rve; int n;
|
|
#else
|
|
-nrv_alloc(char *s, char **rve, int n)
|
|
+nrv_alloc(CONST char *s, char **rve, int n)
|
|
#endif
|
|
{
|
|
char *rv, *t;
|
|
@@ -4202,6 +4201,5 @@
|
|
*rve = s;
|
|
return s0;
|
|
}
|
|
-#ifdef __cplusplus
|
|
-}
|
|
-#endif
|
|
+
|
|
+} // namespace dmg_fp
|
|
Index: g_fmt.cc
|
|
--- g_fmt.cc (old copy)
|
|
+++ g_fmt.cc (new copy)
|
|
@@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
|
|
if (sign)
|
|
*b++ = '-';
|
|
if (decpt == 9999) /* Infinity or Nan */ {
|
|
- while(*b++ = *s++);
|
|
+ while((*b++ = *s++));
|
|
goto done0;
|
|
}
|
|
if (decpt <= -4 || decpt > se - s + 5) {
|
|
*b++ = *s++;
|
|
if (*s) {
|
|
*b++ = '.';
|
|
- while(*b = *s++)
|
|
+ while((*b = *s++))
|
|
b++;
|
|
}
|
|
*b++ = 'e';
|
|
@@ -79,10 +79,10 @@ g_fmt(register char *b, double x)
|
|
*b++ = '.';
|
|
for(; decpt < 0; decpt++)
|
|
*b++ = '0';
|
|
- while(*b++ = *s++);
|
|
+ while((*b++ = *s++));
|
|
}
|
|
else {
|
|
- while(*b = *s++) {
|
|
+ while((*b = *s++)) {
|
|
b++;
|
|
if (--decpt == 0 && *s)
|
|
*b++ = '.';
|
|
@@ -93,7 +93,9 @@ g_fmt(register char *b, double x)
|
|
}
|
|
done0:
|
|
freedtoa(s0);
|
|
+#ifdef IGNORE_ZERO_SIGN
|
|
done:
|
|
+#endif
|
|
return b0;
|
|
}
|
|
|