[Python-Dev] [Python-checkins] r64424 - in python/trunk:Include/object.h Lib/test/test_sys.py Misc/NEWSObjects/intobject.c Objects/longobject.c Objects/typeobject.cPython/bltinmodule.c

Mark Dickinson dickinsm at gmail.com
Fri Jun 27 00:11:35 CEST 2008


On Thu, Jun 26, 2008 at 11:00 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> Definitely.  The paper I referenced in the issue discussion,
> http://bugs.python.org/issue3008   mentioned a few times here, is
> http://hal.archives-ouvertes.fr/docs/00/28/14/29/PDF/floating-point-article.pdf

Perhaps it's worth reproducing the most relevant paragraph of that paper
(the end of section 2.1) here:

"""Conversion to and from decimal representation is delicate; special
care must be taken in order not to introduce inaccuracies or discrepan-
cies. [Steele and White, 1990, Clinger, 1990]. Because of this, C99 introduces
hexadecimal floating-point literals in source code. [ISO, 1999, §6.4.4.2] Their
syntax is as follows: 0xmmmmmm.mmmmp±ee where mmmmmm.mmmm is a mantissa in
hexadecimal, possibly containing a point, and ee is an exponent,
written in deci-
mal, possibly preceded by a sign. They are interpreted as [mmmmmm.mmmm]16×2ee .
Hexadecimal floating-point representations are especially important when val-
ues must be represented exactly, for reproducible results — for instance, for
testing "borderline cases" in algorithms. For this reason, we shall use them in
this paper wherever it is important to specify exact values. See also
Section 4.4
for more information on inputting and outputting floating-point values."""


More information about the Python-Dev mailing list