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

2007-12-18 Thread Christian Heimes
Christian Heimes added the comment: Applied in r59558 to the trunk -- resolution: accepted -> fixed status: open -> closed __ Tracker <[EMAIL PROTECTED]> __ ___

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

2007-12-18 Thread Guido van Rossum
Guido van Rossum added the comment: I suggest you check this in (with the Py_HUGE_VAL fix) and then see how much of #1640 we still need. -- resolution: -> accepted __ Tracker <[EMAIL PROTECTED]>

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

2007-12-18 Thread Guido van Rossum
Guido van Rossum added the comment: > Historical note: Guido is probably thinking of "the old" pickle and > marshal here, which did have problems with inf and NaN on Windows (as in > they didn't work at all). Michael Hudson changed them to use special > bit patterns instead, IIRC for Python 2.5

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

2007-12-18 Thread Tim Peters
Tim Peters added the comment: Historical note: Guido is probably thinking of "the old" pickle and marshal here, which did have problems with inf and NaN on Windows (as in they didn't work at all). Michael Hudson changed them to use special bit patterns instead, IIRC for Python 2.5. ___

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

2007-12-18 Thread Christian Heimes
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

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

2007-12-18 Thread Tim Peters
Tim Peters added the comment: [Guido] > ... > (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. Ha! Yo

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

2007-12-18 Thread Guido van Rossum
Guido van Rossum added the comment: Mostly looks good. Here are some nits. (1) You shouldn't have to add pystrcmp.c to the VC project files since on Windows it isn't used, right? (2) Will the Windows input routine still accept the *old* representations for INF and NAN? IMO that's important (a

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

2007-12-17 Thread Christian Heimes
Christian Heimes added the comment: I'm posting a combined patch for all features at #1640. -- superseder: -> Enhancements for mathmodule __ Tracker <[EMAIL PROTECTED]> __ ___

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

2007-12-17 Thread Christian Heimes
Christian Heimes added the comment: Adam Olsen wrote: > You have: > #define Py_NAN Py_HUGE_VAL * 0 > I think this would be safer as: > #define Py_NAN (Py_HUGE_VAL * 0) > > For instance, in code that may do "a / Py_NAN". You are right! Fixed > Those manual string copies (*cp++ = 'n';) are ugly.

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

2007-12-17 Thread Adam Olsen
Adam Olsen added the comment: You have: #define Py_NAN Py_HUGE_VAL * 0 I think this would be safer as: #define Py_NAN (Py_HUGE_VAL * 0) For instance, in code that may do "a / Py_NAN". Those manual string copies (*cp++ = 'n';) are ugly. Can't you use strcpy() instead? -- nosy: +rhampho

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

2007-12-15 Thread Christian Heimes
Christian Heimes added the comment: Update: I've added a platform independent implementation of stricmp and strnicmp (case insensitive compare). It could be useful for other parts of the code as well. Added file: http://bugs.python.org/file8962/trunk_float_inf_nan2.patch __

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

2007-12-15 Thread Christian Heimes
New submission from Christian Heimes: The patch unifies the creation and representation of "inf", "-inf" and "nan" on all platforms. >>> float("inf") inf >>> float("-inf") -inf >>> float("nan") nan >>> repr(1e300 * 1e300) 'inf' >>> repr(1e300 * 1e300 * 0) 'nan' >>> repr(1e300 * 1e300 * -1) '-in