Issue 1255395: float('-inf') - Python tracker (original) (raw)

Created on 2005-08-10 01:15 by stevenbird, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg26007 - (view) Author: Steven Bird (stevenbird) Date: 2005-08-10 01:15
Python 2.4.1 on Windows raises "ValueError: invalid literal for float(): -inf", though this works just fine on unix distributions of Python 2.4.1.
msg26008 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-08-10 12:35
Logged In: YES user_id=6656 At most, this is a feature request (why did you think it would work?). Floating point to string (and vice versa) conversions are done by the C library implementation, and sadly they are no consistent (you'll notice that printing an infinite value on windows doesn't print out 'inf' either).
msg26009 - (view) Author: Steven Bird (stevenbird) Date: 2005-08-10 12:49
Logged In: YES user_id=195736 Oh, I thought Python 2.4.1 was the same language, regardless of which platform it was running on. I must be missing something here.
msg26010 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-08-10 12:56
Logged In: YES user_id=6656 Well, everything to do with special floating point values is a platform dependent crapshoot (in fact, if you want to read more, googling for "platform dependent crapshoot" works quite well...). Are you interested in working on a patch? It's probably not straightforward at all.
msg26011 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2005-08-11 17:33
Logged In: YES user_id=593130 Snide comments are out of place here. Standard C 89 is generally considered one language even though it has many platform dependencies. Heroic efforts, mostly volunteer, have gone into masking many platform variations. (For instance, look thru the C sources for system/compiler #ifdefs.) These efforts continue. http://docs.python.org/lib/built-in-funcs.html, float([x]) says "Note: When passing in a string, values for NaN and Infinity may be returned, depending on the underlying C library. The specific set of strings accepted which cause these values to be returned depends entirely on the C library and is known to vary." Please read the docs before claiming that documented behavior is a bug.
msg26012 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-08-11 18:21
Logged In: YES user_id=80475 FWIW, googling for the phrase does lead directly to revelant discussion of the issues.
History
Date User Action Args
2022-04-11 14:56:12 admin set github: 42265
2005-08-10 01:15:00 stevenbird create