[docs] [issue37454] Clarify docs for math.log1p()

Tim Peters report at bugs.python.org
Mon Jul 1 11:38:47 EDT 2019


Tim Peters <tim at python.org> added the comment:

Mark's analysis is spot-on - good eye :-)

Here under 3.7.3 [MSC v.1916 64 bit (AMD64)] on win32, in the original script it makes no difference at all for negative "small x" (where, as Mark said, `1 - random.random()` is exactly representable):

Counter({'equal': 50058, 'offset_log': 41936, 'regular_log': 8006})
Counter({'equal': 100000})

Changing to Mark's 1e-3 * random.random():

Counter({'offset_log': 99958, 'equal': 42})
Counter({'offset_log': 99884, 'equal': 116})

And going on to use 1e-6 instead:

Counter({'offset_log': 100000})
Counter({'offset_log': 100000})

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37454>
_______________________________________


More information about the docs mailing list