36 g_dfmt(buf, d, ndig, bufsize)
char* buf;
41 g_dfmt(
char *buf,
double *d,
int ndig,
unsigned bufsize)
44 static FPI fpi = {53, 1 - 1023 - 53 + 1, 2046 - 1023 - 53 + 1, 1, 0};
46 ULong bits[2], *L, sign;
47 int decpt, ex, i, mode;
55 if(bufsize < (
unsigned)ndig + 10)
61 sign = L[_0] & 0x80000000L;
62 if((L[_0] & 0x7ff00000) == 0x7ff00000)
65 if(L[_0] & 0xfffff || L[_1])
67 return strcp(buf,
"NaN");
76 return strcp(b,
"Infinity");
78 if(L[_1] == 0 && (L[_0] ^ sign) == 0 )
81 #ifndef IGNORE_ZERO_SIGN 82 if(L[_0] & 0x80000000L)
94 bits[1] = L[_0] & 0xfffff;
95 if((ex = (L[_0] >> 20) & 0x7ff) != 0)
120 s =
gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
121 return g__fmt(buf, s, se, decpt, sign);
char * g__fmt(char *b, char *s, const char *se, int decpt, ULong sign)
char * gdtoa(FPI *fpi, int be, ULong *bits, int *kindp, int mode, int ndigits, int *decpt, char **rve)
char * g_dfmt(char *buf, double *d, int ndig, unsigned bufsize)