intcomma returns exponential notation for large floats

Open Beginner friendly
#521 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Omarinho12345 is already working on this.

Since Nov 19, 2026.

  • #522 by @Omarinho12345 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start by locating intcomma() and its tests, then reproduce the reported difference between intcomma(1e16) and intcomma(10**16); the issue does not name file paths. Check how the formatting path handles floats at and above 1e16, while preserving the unaffected ndigits behavior. Done when the large float returns '10,000,000,000,000,000.0' and the relevant tests pass.

Written by the indexing model from the issue text.

Description

Description

intcomma() returns exponential notation instead of a comma-grouped number for
large floats. The exponent form starts at 1e16, while the equivalent integer
and smaller floats are grouped correctly.

Reproduction

>>> import humanize
>>> humanize.intcomma(1e16)
'1e+16'
>>> humanize.intcomma(10**16)
'10,000,000,000,000,000'
>>> humanize.intcomma(1e15)
'1,000,000,000,000,000.0'

Expected

intcomma(1e16) should be '10,000,000,000,000,000.0', matching the behaviour
for floats below 1e16.

Cause

f"{value:,}" falls back to scientific notation for floats at or above 1e16,
which bypasses the comma grouping. The ndigits path is not affected.

Dominant language
Python
Stars
768
Forks
243
Avg merge
4d 12h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-humanize/humanize

All issues in python-humanize/humanize

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.