Improve readability of SI format for very small/large numbers

オープン
#111 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript

調査の方向性

Read the formatter implementation and tests for the "s" and "e" formats; the issue does not name their files. Check how SI prefixes are selected and how exponent notation is produced, then compare behavior around the proposed 1e-24 and 1e24 thresholds. Done means very small and large values use exponent notation while values in the usual SI range keep their existing format.

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

説明

It would be great to improve the 'human-readability' of SI format "s" for very small/large numbers. At the moment d3-format generates:

console.log(format("s")(1e-50))  -> "0.00000000000000000000000001y"
console.log(format("s")(1e+50)) -> "100000000000000000000000000Y"

I would propose to fall back to exponent notation ("e" format) for numbers below abs(x)<1e-24 or above abs(x)>1e24.

In my application, usually the numbers are in a range where the "s"-format makes sense. Though, sometimes, e.g. due to numerical inaccuracy of calculations, I get very small numbers, that blow-up my output.

主要言語
JavaScript
スター
643
フォーク
107
平均マージ
6時間 25分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

d3/d3-format のほかの issue

d3/d3-format の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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