Bug in math.frexp?

Tim Peters tim_one at email.msn.com
Sun Jul 2 16:17:07 EDT 2000


[Kirill Simonov]
> $ python
> Python 1.6a2 (#2, Jun 24 2000, 12:18:54)  [GCC egcs-2.91.66
> 19990314/Linux (egcs-1.1.2 release)] on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import math
> >>> print math.frexp.__doc__
> frexp(x)
>
> Return the matissa and exponent for x. The mantissa is positive.
> >>> math.frexp(-1)
> (-0.5, 1)
>
> In this example the mantissa is negative.

The docs are wrong.  I just checked in a repaired version of mathmodule.c.
Fred, would you please get the truth into the Library Reference Manual's
math module docs too?

C:\pysrc\python\dist\src\PCbuild>python
Python 2.0b1 (#0, Jul  1 2000, 11:28:35) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)
>>> import math
>>> print math.frexp.__doc__
frexp(x)

Return the matissa and exponent of x, as pair (m, e).
m is a float and e is an int, such that x = m * 2.**e.
If x is 0, m and e are both 0.  Else 0.5 <= abs(m) < 1.0.
>>> math.frexp(0), math.frexp(-2), math.frexp(4)
((0.0, 0), (-0.5, 2), (0.5, 3))
>>>






More information about the Python-list mailing list