[issue4024] float(0.0) singleton

2012-03-22 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson : -- superseder: -> Intern certain integral floats for memory savings and performance ___ Python tracker ___ __

[issue4024] float(0.0) singleton

2009-03-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: I have 3 comments for future readers who might want to reopen. 1) This would have little effect on calculation with numpy. 2) According to sys.getrefcount, when '>>>' appears, 3.0.1 has 1200 duplicate references to 0 and 1 alone, and about 2000 to all of them.

[issue4024] float(0.0) singleton

2009-03-19 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> rejected status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue4024] float(0.0) singleton

2009-03-19 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: -haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue4024] float(0.0) singleton

2008-10-03 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: I question whether this should be done at all. Making the creation of a float even slightly slower is bad. This is on the critical path for all floating point intensive computations. If someone really cares about the memory savings, it i

[issue4024] float(0.0) singleton

2008-10-03 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Please use copysign(1.0, fval) == 1.0 instead of your memcpy trick. It's the cannonical way to check for negative zero. copysign() is always available because we have our own implementation if the platform doesn't provide one. We might also

[issue4024] float(0.0) singleton

2008-10-03 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: We need maybe more hardcoded floats. I mean a "cache" of current float. Example of pseudocode: def cache_float(value): return abs(value) in (0.0, 1.0, 2.0) def create_float(value): try: return cache[value] except KeyError:

[issue4024] float(0.0) singleton

2008-10-03 Thread lplatypus
lplatypus <[EMAIL PROTECTED]> added the comment: No it won't distinguish between +0.0 and -0.0 in its present form, because these two have the same value according to the C equality operator. This should be easy to adjust, eg we could exclude -0.0 by changing the comparison if (fval == 0.0)

[issue4024] float(0.0) singleton

2008-10-03 Thread Georg Brandl
Georg Brandl <[EMAIL PROTECTED]> added the comment: Will it correctly distinguish between +0.0 and -0.0? -- nosy: +georg.brandl ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue4024] float(0.0) singleton

2008-10-02 Thread lplatypus
New submission from lplatypus <[EMAIL PROTECTED]>: Here is a patch to make PyFloat_FromDouble(0.0) always return the same float instance. This is similar to the existing optimization in PyInt_FromLong(x) for small x. My own motivation is that the patch reduces memory by several megabytes for