sprintf and printfn float formats %e, %g, and %f differ from .NET
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
- 領域
- backend
調査の方向性
Start by locating Fable's implementation of sprintf and printfn float formatting, then compare its %e, %g, and %f behavior with the .NET expectations and repro cases in the issue. Run the relevant formatting tests and add coverage for the listed edge cases, including precision zero and negative zero. Done when the outputs match the expected results and %.0g no longer throws.
索引モデルが issue の本文から書いたものです。
説明
Description
In Fable 5.27.0 targeting JavaScript/TypeScript, sprintf/printfn float format specifiers %e/%E, %g/%G, and %f diverge from .NET (String.Format in the same runtime already follows the .NET rules), and %.0g throws a RangeError (regression from 5.26.0).
Per the F# plaintext formatting reference, %e/%E defaults to precision 6 with a 3-digit exponent and matching case, %g/%G strips trailing zeros (treating precision 0 as default), %f never switches to exponential notation, and negative zero keeps its - sign.
Repro code
for s in [
sprintf "%e" 3.0
sprintf "%E" 3.0
sprintf "%.2g" 1e301
sprintf "%.8g" 0.0
sprintf "%.4e" -0.0
sprintf "%f" -0.0
sprintf "%.0f" 1e21
sprintf "%.0g" 2.5
] do
printfn "%s" s
Expected and actual results
Expected (.NET 10):
3.000000e+000
3.000000E+000
1e+301
0
-0.0000e+000
-0.000000
1000000000000000000000
2.5
Actual under Fable 5.27.0 (Node.js v24.14.1): the first seven lines print 3e+0, 3e+0, 1.0e+301, 0.0000000, 0.0000e+0, 0.000000, and 1e+21, and sprintf "%.0g" 2.5 throws RangeError: toPrecision() argument must be between 1 and 100.
Related information
- Fable version: 5.27.0
- Operating system: macOS 26.3 (Node.js v24.14.1, .NET 10)
Credit: https://ucsbplse.github.io/
- 主要言語
- F#
- スター
- 3.2k
- フォーク
- 335
- 平均マージ
- 19時間 39分
- マージ済み PR(30日)
- 158
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fable-compiler/Fable のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
fable-compiler/Fable#5280 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows automation repo-assist
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
fable-compiler/Fable#4531 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows automation repo-assist
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
fable-compiler/Fable#4522 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
fable-compiler/Fable#5286 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 36/100
fable-compiler/Fable#5285 ·
メンテナーはふだん 1 日以内に返信
fable-compiler/Fable の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 4 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
NVIDIA/auto-ontology#463 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
RustCrypto/utils#1597 ·
メンテナーはふだん 1 日以内に返信
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeout対応中かも @floriankoch が今日担当しました。 オープンtriage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
envoyproxy/gateway#10562 ·
メンテナーはふだん 1 日以内に返信