[New-bugs-announce] [issue18739] math.log of a long returns a different value of math.log of an int
Gregory P. Smith
report at bugs.python.org
Wed Aug 14 17:04:47 CEST 2013
New submission from Gregory P. Smith:
This is a very odd inconsistency in math.log behavior. That said, it is probably only a single bit imprecision at the end of the float result. Still, 10 == 10L so I'd expect math.log of both to give the same result.
oss/cpython/2.7:LOAS$ ./python
Python 2.7.5+ (2.7:395ac61ebe1a, Aug 14 2013, 07:11:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.log(10) - math.log(10L)
4.440892098500626e-16
>>> math.log(10)
2.302585092994046
>>> math.log(10L)
2.3025850929940455
>>>
In Python 3.3 things seem fine and match the int behavior from 2.7 above despite the internal number implementation being a PyLong in 3.x:
>>> math.log(10)
2.302585092994046
----------
messages: 195175
nosy: gregory.p.smith
priority: normal
severity: normal
status: open
title: math.log of a long returns a different value of math.log of an int
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18739>
_______________________________________
More information about the New-bugs-announce
mailing list