Christian Heimes added the comment:
Applied in r59254.
I've moved the code to floatobject.c/h and added PyFloat_GetMax() and
PyFloat_GetMin(), too. The intobject.c file has a similar function.
--
resolution: - fixed
status: open - closed
__
Tracker
Mark Dickinson added the comment:
A (probably stupid) question: what's supposed to happen on platforms that
don't define things like DBL_MAX_10_EXP, which isn't part of ANSI C89? Or
are there no such platforms?
--
nosy: +marketdickinson
__
Tracker
Christian Heimes added the comment:
I've checked all major platforms before committing the patch. They all
have a float.h with the information available. Do you know of a platform
where this information isn't available? I could add a lot of #ifdef but
I don't feel like bloating the code unless
Mark Dickinson added the comment:
And it looks as though DBL_MAX_10_EXP *is* part of ANSI C anyway... I
shouldn't have assumed that just because it's not in Kernighan and Ritchie
(2nd edition) it doesn't exist... Apologies.
__
Tracker [EMAIL PROTECTED]
Mark Dickinson added the comment:
No, I don't know of any platforms that don't define these constants.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1534
__
___
Christian Heimes added the comment:
Thanks for checking it out for me! Do you have a reliable online source
for the ANSI C89 standard? I'm usually using the GNU C Library docs but
the site doesn't list what's available in C89.
__
Tracker [EMAIL PROTECTED]
Mark Dickinson added the comment:
The site that persuaded me about DBL_MAX_10_EXP was
http://www.schweikhardt.net/identifiers.html
Googling 'C89 draft' also turns up some potentially useful stuff.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1534
New submission from Christian Heimes:
Currently Python has no information about the maximum and minimum value
of a float. The patch adds a dict with all important information to sys:
pprint.pprint(sys.maxfloat)
{'dig': 15,
'epsilon': 2.2204460492503131e-16,
'mant_dig': 53,
'max':
Guido van Rossum added the comment:
I'd suggest giving it a different name, maybe float_info. sys.maxfloat
suggests the value is a float, like sys.maxint and sys.maxunicode.
--
nosy: +gvanrossum
__
Tracker [EMAIL PROTECTED]