intcomma returns exponential notation for large floats

オープン 初心者向け
#521 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Omarinho12345 がすでに取り組んでいます。

2026年11月19日 から。

  • #522 @Omarinho12345 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

まず intcomma() とそのテストを見つけ、報告された intcomma(1e16) と intcomma(10**16) の違いを再現してください。issue にはファイルパスの記載がありません。1e16 以上の float をフォーマット処理がどのように扱うかを確認し、ndigits の従来の動作は維持してください。大きな float が '10,000,000,000,000,000.0' を返し、関連するテストが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
768
フォーク
243
平均マージ
4日 12時間
マージ済み PR(30日)
19

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python-humanize/humanize のほかの issue

python-humanize/humanize の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。