Skip to content

docs(cli): Document General format scientific notation behavior #177

@arcaputo3

Description

@arcaputo3

Summary

Users are surprised when long decimal numbers display in scientific notation. This is expected Excel behavior, not a bug, but needs documentation.

Severity: Low | Effort: Trivial

Current Behavior

xl -f in.xlsx view A1
# A1 contains: 0.123456789012
# Output: 1.234568E-01

Root Cause (Not a Bug)

NumFmtFormatter.formatGeneral() intentionally switches to scientific notation when string length > 11 characters:

// NumFmtFormatter.scala lines 127-133
if str.length > 11 then f"${n.toDouble}%.6E"

This matches Excel's General format behavior and is independent of column width.

Workaround

Users should apply explicit NumFmt for financial precision:

xl -f in.xlsx -o out.xlsx style A1 --num-fmt number

Action Items

  • Add note to CLI help for view command explaining General format behavior
  • Add example in docs/reference/cli.md showing how to preserve decimal display
  • Consider adding a --format precision option for view command (separate enhancement)

Key Files

  • xl-core/src/com/tjclp/xl/display/NumFmtFormatter.scala (lines 127-133)
  • docs/reference/cli.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions