[issue31980] Special case log(x, 2), log(x, 10) and pow(2, x)
Mark Dickinson
report at bugs.python.org
Wed Nov 8 15:12:18 EST 2017
Mark Dickinson <dickinsm at gmail.com> added the comment:
Also, prec_log would need significant work to make it handle all the corner cases sensibly. For example:
Python 3.6.3 (default, Oct 5 2017, 23:34:28)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> def prec_log(x, y):
... a = math.log(x, y)
... return a + math.log(x / math.pow(y, a), y)
...
>>> math.log(3**1000, 3)
999.9999999999999
>>> prec_log(3**1000, 3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in prec_log
OverflowError: math range error
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31980>
_______________________________________
More information about the Python-bugs-list
mailing list