return SF_INFINITE;
*sign = *decpt = 0;
-
-#if !defined(_ast_fltmax_double)
- if (format & SFFMT_LDOUBLE) {
- Sfdouble_t dval = *((Sfdouble_t *) dv);
-
- if (dval == 0.)
- return SF_ZERO;
- else if ((*sign = (dval < 0.))) /* assignment = */
- dval = -dval;
-
- n = 0;
- if (dval >= (Sfdouble_t) SF_MAXLONG) { /* scale to a small enough number to fit an int */
- v = SF_MAXEXP10 - 1;
- do {
- if (dval < _Sfpos10[v])
- v -= 1;
- else {
- dval *= _Sfneg10[v];
- if ((n += (1 << v)) >= SF_IDIGITS)
- return SF_INFINITE;
- }
- } while (dval >= (Sfdouble_t) SF_MAXLONG);
- }
- *decpt = (int) n;
-
- buf = sp = Buf + SF_INTPART;
- if ((v = (int) dval) != 0) { /* translate the integer part */
- dval -= (Sfdouble_t) v;
-
- sfucvt(v, sp, n, ep, long, ulong);
-
- n = buf - sp;
- if ((*decpt += (int) n) >= SF_IDIGITS)
- return SF_INFINITE;
- buf = sp;
- sp = Buf + SF_INTPART;
- } else
- n = 0;
-
- /* remaining number of digits to compute; add 1 for later rounding */
- n = (((format & SFFMT_EFORMAT)
- || *decpt <= 0) ? 1 : *decpt + 1) - n;
- if (n_digit > 0)
- n += n_digit;
-
- if ((ep = (sp + n)) > (endsp = Buf + (SF_MAXDIGITS - 2)))
- ep = endsp;
- if (sp > ep)
- sp = ep;
- else {
- if ((format & SFFMT_EFORMAT) && *decpt == 0 && dval > 0.) {
- Sfdouble_t d;
- while ((int) (d = dval * 10.) == 0) {
- dval = d;
- *decpt -= 1;
- }
- }
-
- while (sp < ep) { /* generate fractional digits */
- if (dval <= 0.) { /* fill with 0's */
- do {
- *sp++ = '0';
- } while (sp < ep);
- goto done;
- } else if ((n = (long) (dval *= 10.)) < 10) {
- *sp++ = '0' + n;
- dval -= n;
- } else { /* n == 10 */
- do {
- *sp++ = '9';
- } while (sp < ep);
- }
- }
- }
- } else
-#endif
{
double dval = *((double *) dv);
#define remove unlink
#endif
-#if !defined(_ast_fltmax_double)
-
-#if defined(_lib_qfrexp) && _lib_qldexp
-#define _has_expfuncs 1
-#define frexp qfrexp
-#define ldexp qldexp
-#else
-#define _has_expfuncs 0
-#endif
-
-#endif/*_ast_fltmax_double*/
-
/* 64-bit vs 32-bit file stuff */
#if _sys_stat
#ifdef _LARGEFILE64_SOURCE
/* floating point to ascii conversion */
#define SF_MAXEXP10 6
#define SF_MAXPOW10 (1 << SF_MAXEXP10)
-#if !defined(_ast_fltmax_double)
-#define SF_FDIGITS 1024 /* max allowed fractional digits */
-#define SF_IDIGITS (8*1024) /* max number of digits in int part */
-#else
#define SF_FDIGITS 256 /* max allowed fractional digits */
#define SF_IDIGITS 1024 /* max number of digits in int part */
-#endif
#define SF_MAXDIGITS (((SF_FDIGITS+SF_IDIGITS)/sizeof(int) + 1)*sizeof(int))
/* tables for numerical translation */
} else
n = 0;
-#if !defined(_ast_fltmax_double) /* don't know how to do these yet */
- if (v > DBL_MAX && !_has_expfuncs) {
- SFOPEN(f, 0);
- SFMTXRETURN(f, -1);
- }
-#endif
-
/* make the magnitude of v < 1 */
if (v != 0.)
v = frexp(v, &exp);
switch (_Sftype[fp[n].ft.fmt]) {
case SFFMT_INT:
case SFFMT_UINT:
-#if !_ast_intmax_long
- if (FMTCMP(size, Sflong_t, Sflong_t))
- fp[n].argv.ll = va_arg(args, Sflong_t);
- else
-#endif
if (FMTCMP(size, long, Sflong_t))
fp[n].argv.l = va_arg(args, long);
else
fp[n].argv.i = va_arg(args, int);
break;
case SFFMT_FLOAT:
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t))
- fp[n].argv.ld = va_arg(args, Sfdouble_t);
- else
-#endif
fp[n].argv.d = va_arg(args, double);
break;
case SFFMT_POINTER:
int sign, decpt;
ssize_t size;
double dval;
-#if !defined(_ast_fltmax_double)
- Sfdouble_t ldval;
-#endif
char *tls[2], **ls; /* for %..[separ]s */
char *t_str; /* stuff between () */
ssize_t n_str; /* its length */
switch (_Sftype[fmt]) {
case SFFMT_INT:
case SFFMT_UINT:
-#if !_ast_intmax_long
- if (FMTCMP(size, Sflong_t, Sflong_t))
- argv.ll = va_arg(args, Sflong_t);
- else
-#endif
if (FMTCMP(size, long, Sflong_t))
argv.l = va_arg(args, long);
else
argv.i = va_arg(args, int);
break;
case SFFMT_FLOAT:
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t))
- argv.ld = va_arg(args, Sfdouble_t);
- else
-#endif
argv.d = va_arg(args, double);
break;
case SFFMT_POINTER:
case 'n': /* return current output length */
SFEND(f);
-#if !_ast_intmax_long
- if (FMTCMP(size, Sflong_t, Sflong_t))
- *((Sflong_t *) argv.vp) = (Sflong_t) n_output;
- else
-#endif
if (FMTCMP(size, long, Sflong_t))
*((long *) argv.vp) = (long) n_output;
else if (sizeof(short) < sizeof(int) &&
n_s = base == 10 ? -1 : 0;
int_arg:
-#if !_ast_intmax_long || _more_long_int || _more_void_int
+#if _more_long_int || _more_void_int
if (FMTCMP(size, Sflong_t, Sflong_t)) {
lv = argv.ll;
goto long_cvt;
case 'e':
case 'E':
case 'f':
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t))
- ldval = argv.ld;
- else
-#endif
if (!(ft && ft->extf && (ft->flags & SFFMT_VALUE)) ||
FMTCMP(size, double, Sfdouble_t))
dval = argv.d;
if (fmt == 'e' || fmt == 'E') {
n = (precis = precis < 0 ? FPRECIS : precis) + 1;
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) {
- ep = _sfcvt(&ldval, min(n, SF_FDIGITS),
- &decpt, &sign,
- SFFMT_EFORMAT | SFFMT_LDOUBLE);
- } else
-#endif
{
ep = _sfcvt(&dval, min(n, SF_FDIGITS),
&decpt, &sign, SFFMT_EFORMAT);
goto e_format;
} else if (fmt == 'f' || fmt == 'F') {
precis = precis < 0 ? FPRECIS : precis;
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) {
- ep = _sfcvt(&ldval, min(precis, SF_FDIGITS),
- &decpt, &sign, SFFMT_LDOUBLE);
- } else
-#endif
{
ep = _sfcvt(&dval, min(precis, SF_FDIGITS),
&decpt, &sign, 0);
/* 'g' or 'G' format */
precis = precis < 0 ? FPRECIS : precis == 0 ? 1 : precis;
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t)) {
- ep = _sfcvt(&ldval, min(precis, SF_FDIGITS),
- &decpt, &sign, SFFMT_EFORMAT | SFFMT_LDOUBLE);
- if (ldval == 0.)
- decpt = 1;
- else if (*ep == 'I')
- goto infinite;
- } else
-#endif
{
ep = _sfcvt(&dval, min(precis, SF_FDIGITS),
&decpt, &sign, SFFMT_EFORMAT);
/* build the exponent */
ep = endep = buf + (sizeof(buf) - 1);
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t))
- dval = ldval ? 1. : 0.; /* so the below test works */
-#endif
if (dval != 0.) {
if ((n = decpt - 1) < 0)
n = -n;
value = va_arg(args, void *);
if (fmt == 'n') { /* return length of consumed input */
-#if !_ast_intmax_long
- if (FMTCMP(size, Sflong_t, Sflong_t))
- *((Sflong_t *) value) = (Sflong_t) (n_input + SFLEN(f));
- else
-#endif
if (sizeof(long) > sizeof(int) && FMTCMP(size, long, Sflong_t))
*((long *) value) = (long) (n_input + SFLEN(f));
else if (sizeof(short) < sizeof(int) &&
if (value) {
*val = '\0';
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t))
- argv.ld = _sfstrtod(accept, NIL(char **));
- else
-#endif
argv.d = (double) strtod(accept, NIL(char **));
}
if (value) {
n_assign += 1;
-#if !defined(_ast_fltmax_double)
- if (FMTCMP(size, Sfdouble_t, Sfdouble_t))
- *((Sfdouble_t *) value) = argv.ld;
- else
-#endif
if (FMTCMP(size, double, Sfdouble_t))
*((double *) value) = argv.d;
else
*((void **) value) = (void *) ((ulong) argv.lu);
#else
*((void **) value) = (void *) ((uint) argv.lu);
-#endif
-#if !_ast_intmax_long
- else if (FMTCMP(size, Sflong_t, Sflong_t))
- *((Sflong_t *) value) = argv.ll;
#endif
else if (sizeof(long) > sizeof(int) &&
FMTCMP(size, long, Sflong_t)) {