Skip to content

log(Decimal(x)) is broken for large x #106502

Closed
@ra1u

Description

@ra1u

issue is that for large x math.log(Decimal(x)) returns inf

I am not sure if that is an issue with documentation or implementation

Python 3.11.4 (main, Jun  7 2023, 10:13:09) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import log
>>> from decimal import Decimal
>>> d = Decimal(300**300)
>>> d
Decimal('136891479058588375991326027382088315966463695625337436471480190078368997177499076593800206155688941388250484440597994042813512732765695774566001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')
>>> log(d)
inf
>>> log(int(d))
1711.1347423968602

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions