Silence gcc 'comparison always false' warning

This commit is contained in:
Mark Dickinson 2009-08-28 20:46:24 +00:00
parent f7cda5287d
commit 2fdd58ad18
2 changed files with 6 additions and 2 deletions

View file

@ -4341,14 +4341,16 @@ formatfloat(char *buf, size_t buflen, int flags,
} }
if (prec < 0) if (prec < 0)
prec = 6; prec = 6;
#if SIZEOF_INT > 4
/* make sure that the decimal representation of precision really does /* make sure that the decimal representation of precision really does
need at most 10 digits: platforms with sizeof(int) == 8 exist! */ need at most 10 digits: platforms with sizeof(int) == 8 exist! */
if (prec > 0x7fffffffL) { if (prec > 0x7fffffff) {
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"outrageously large precision " "outrageously large precision "
"for formatted float"); "for formatted float");
return -1; return -1;
} }
#endif
if (type == 'f' && fabs(x) >= 1e50) if (type == 'f' && fabs(x) >= 1e50)
type = 'g'; type = 'g';

View file

@ -8325,14 +8325,16 @@ formatfloat(Py_UNICODE *buf,
return -1; return -1;
if (prec < 0) if (prec < 0)
prec = 6; prec = 6;
#if SIZEOF_INT > 4
/* make sure that the decimal representation of precision really does /* make sure that the decimal representation of precision really does
need at most 10 digits: platforms with sizeof(int) == 8 exist! */ need at most 10 digits: platforms with sizeof(int) == 8 exist! */
if (prec > 0x7fffffffL) { if (prec > 0x7fffffff) {
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"outrageously large precision " "outrageously large precision "
"for formatted float"); "for formatted float");
return -1; return -1;
} }
#endif
if (type == 'f' && fabs(x) >= 1e50) if (type == 'f' && fabs(x) >= 1e50)
type = 'g'; type = 'g';