classification
Title: stdtypes.rst should refer to sys.float_info
Type: behavior Stage:
Components: Documentation Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: docs@python, georg.brandl, mark.dickinson, ygale
Priority: normal Keywords: patch

Created on 2010-08-03 20:37 by ygale, last changed 2010-08-04 18:49 by mark.dickinson. This issue is now closed.

Files
File name Uploaded Description Edit
stdtypes_float_info.patch ygale, 2010-08-03 20:37 Add reference to sys.float_info to stdtypes.rst for 3.2
stdtypes_float_info_2.patch ygale, 2010-08-03 21:31 Corrected patch to add reference to sys.float_info and keep a qualified mention of C doubles.
Messages (6)
msg112670 - (view) Author: Yitz Gale (ygale) Date: 2010-08-03 20:37
Library docs section 5.4 "Numeric Types" states about floating point numbers that "all bets on their precision are off unless you happen to know the machine you are working with."

That has not been true since Python 2.6, when sys.float_info was added. There should be a reference to that here instead of that statement.

In addition, that paragraph mentions that both float and complex are "implemented using double in C". There is no longer any special reason to mention how those are implemented in C, any more than anything else in Python. Everything you need to know about the implementation is in sys.float_info. (Well, almost everything, see #9192.)

The attached patch is for the Python 3.2 branch.
msg112671 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-08-03 20:39
Mark, does this look ok to you?
msg112674 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-03 20:45
+1 for the reference to sys.float_info.

I'd prefer to keep the mention of C doubles, though.  You have to know what you're looking for to get this information from looking at sys.float_info.
msg112682 - (view) Author: Yitz Gale (ygale) Date: 2010-08-03 21:03
It's not necessarily true for other than CPython, and it could theoretically not be true someday on some weird platform even for CPython.
 
How about just adding this: "Floating point numbers are usually implemented using double in C." Then at least we're not committing ourselves to anything.
msg112683 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-03 21:06
> it could theoretically not be true someday on some weird platform even for CPython.

Granted.  Though it would be quite a major change: the 'double' part is heavily hard-coded throughout.

> How about just adding this: "Floating point numbers are usually
> implemented using double in C." Then at least we're not committing 
> ourselves to anything.

That sounds fine to me.
msg112859 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-04 18:49
Thanks!  Applied in revisions r83732 through r83734.  (The release26-maint branch is frozen except for essential fixes, so not applying it there.)
History
Date User Action Args
2010-08-04 18:49:59mark.dickinsonsetstatus: open -> closed
resolution: accepted
messages: + msg112859

versions: - Python 2.6
2010-08-03 21:31:47ygalesetfiles: + stdtypes_float_info_2.patch
2010-08-03 21:06:31mark.dickinsonsetmessages: + msg112683
2010-08-03 21:03:07ygalesetmessages: + msg112682
2010-08-03 20:45:16mark.dickinsonsetmessages: + msg112674
2010-08-03 20:39:27georg.brandlsetassignee: docs@python -> mark.dickinson

messages: + msg112671
nosy: + mark.dickinson, georg.brandl
2010-08-03 20:37:32ygalecreate