Skip to content

Feature request: handle NaN #62

@bersbersbers

Description

@bersbersbers

What did you do?

import humanize, math
humanize.metric(math.nan)

What did you expect to happen?

"NaN"

What actually happened?

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\bers\.pyenv-win-venv\envs\project\lib\site-packages\humanize\number.py", line 519, in metric
exponent = int(math.floor(math.log10(abs(value)))) if value != 0 else 0
ValueError: cannot convert float NaN to integer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions