[Patches] fix overflow bug in ldexp(x, exp)
Tim Peters
tim_one@email.msn.com
Tue, 9 May 2000 02:55:17 -0400
[Trent Mick]
> ...
> I think that ldexp() should *not* accept a float for the 'exp' argument
> because the rounding to an int is not obvious to the user.
I agree, although a float may nevertheless be an exact integer (like 2.0).
The NumPy folks would probably prefer a rule based on exactness rather than
on concrete type. Screw 'em <wink>.
> I suppose the 'O&' formatter could be used with a special converter
> that raises a TypeError if the argument is not an integral type (i.e.
> PyInt or PyLong). Is it worth making that change? Is it even desired
> to make that change because it might break some code out there.
Good question; ldexp's source code comment:
/* Cheat -- allow float as second argument */
leaves the reason for the current behavior a mystery.
Note another current revoltingism:
>>> range(1., 8., 3.5)
[1, 4, 7]
>>>
OK by me if all such crap "gets broke".