Re: [Python-Dev] Adding DBL_MANTISSA and such to Python

2005-05-05 Thread Michael Hudson
"Edward C. Jones" <[EMAIL PROTECTED]> writes: > Recently I needed some information about the floating point numbers on > my machine. So I wrote a tiny C99 program with the line > > printf("%a\n", DBL_EPSILON); > > The answer was "0x1p-52". > > A search of comp.lang.python shows that I was not alo

Re: [Python-Dev] Adding DBL_MANTISSA and such to Python

2005-05-05 Thread Josiah Carlson
Josiah Carlson <[EMAIL PROTECTED]> wrote: unsigned vv > For 64 bit signed integers: > struct.pack("Q",...) > struct.unpack("Q",...) My fingers were typing too fast (I do much work with unsigned 64 bit integers, but not much with unsigned ones). - Josiah ___

Re: [Python-Dev] Adding DBL_MANTISSA and such to Python

2005-05-05 Thread Josiah Carlson
"Edward C. Jones" <[EMAIL PROTECTED]> wrote: > 3. Add full "tostring" and "fromstring" capabilities for Python numeric > types. "tostring(x)" would return a string containing the binary > representation of x. For example, if x is a Python float, "tostring(x)" > would have eight characters. "fr

Re: [Python-Dev] Adding DBL_MANTISSA and such to Python

2005-05-04 Thread Martin v. Löwis
Edward C. Jones wrote: > The documentation should discuss portability. This is the critical issue here. Discussing portability is not enough; these features really ought to be either available on a majority of the installations, or not available at all. In particular, they would need to be availab

[Python-Dev] Adding DBL_MANTISSA and such to Python

2005-05-04 Thread Edward C. Jones
Recently I needed some information about the floating point numbers on my machine. So I wrote a tiny C99 program with the line printf("%a\n", DBL_EPSILON); The answer was "0x1p-52". A search of comp.lang.python shows that I was not alone. Here are some ideas. 1. Add to Python the constants in