Skip to content

metric(0) crashes #57

@bersbersbers

Description

@bersbersbers

What did you do?

python -c "import humanize; humanize.metric(0)"

What did you expect to happen?

No crash

What actually happened?

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\bers\AppData\Local\Programs\Python\Python310\lib\site-packages\humanize\number.py", line 511, in metric
    exponent = int(math.floor(math.log10(abs(value))))
ValueError: math domain error

What versions are you using?

  • OS: Windows 10
  • Python: 3.10.7
  • Humanize: 4.3.0

Please include code that reproduces the issue.

import humanize
humanize.metric(0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions