[issue1635] Float patch for inf and nan on Windows (and other platforms)

Christian Heimes report at bugs.python.org
Tue Dec 18 22:12:23 CET 2007


Christian Heimes added the comment:

Guido van Rossum wrote:
> (1) You shouldn't have to add pystrcmp.c to the VC project files since
> on Windows it isn't used, right?

It was the easiest way to test the functions in pystrcmp. Linux doesn't
have stricmp but it also doesn't require the additional code to mangle
1.#INF into inf.

> (2) Will the Windows input routine still accept the *old*
> representations for INF and NAN?  IMO that's important (a) so as to be
> able to read old pickles or marshalled data, (b) so as to be able to
> read data files written by C programs.

See Tim's answer.
Pickles and other C programs aren't an issue. Internally NaNs and INFs
are represented with a special bit pattern (all bits of the exponent are
set). As long as users don't use str() or repr() on floats it still
works. The pickle module uses struct.

> (3) Shouldn't you be using Py_HUGE_VAL instead of HUGE_VAL in the chunk
> starting at line 187 in floatobject.c?

I missed the spot, thanks.

Christian

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1635>
__________________________________


More information about the Python-bugs-list mailing list