Skip to content

InputForm of a low-precision number shows the digits it keeps, as in WMA - #2064

Merged
rocky merged 2 commits into
masterfrom
agent/MATH-260
Oct 21, 2026
Merged

rocky merged 2 commits into
masterfrom
agent/MATH-260

Conversation

@tombouctou

Copy link
Copy Markdown
Collaborator

Since #2060 a PrecisionReal with fewer than 64 bits of precision keeps its
value with 64 bits (_extended), but InputForm and FullForm printed only
the digits that the precision gives, so the printed form did not read back
as the same number.

As in WMA, InputForm and FullForm now print the shortest decimal string that
reads back as the kept value; OutputForm and StandardForm still print the
digits of the precision. WMA 15:

InputForm[3.1415926535897932385`3]  ->  3.1415926535897932385`3.
InputForm[-4.326563712`2]           ->  -4.326563712`2.
InputForm[-4.32`4]                  ->  -4.32`4.

(the last two are in test/format/format_tests-WMA.yaml; the Mathics
expectation for -4.326563712`2 in format_tests.yaml is updated to match).

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

🤖 Generated with Claude Code

tombouctou and others added 2 commits October 21, 2026 11:24
…s, as in WMA

Since #2060 a PrecisionReal with fewer than 64 bits of precision keeps its
value with 64 bits (``_extended``), but InputForm and FullForm printed only
the digits that the precision gives, so the printed form did not read back
as the same number.

As in WMA, InputForm and FullForm now print the shortest decimal string that
reads back as the kept value; OutputForm and StandardForm still print the
digits of the precision. WMA 15:

    InputForm[3.1415926535897932385`3]  ->  3.1415926535897932385`3.
    InputForm[-4.326563712`2]           ->  -4.326563712`2.
    InputForm[-4.32`4]                  ->  -4.32`4.

(the last two are in test/format/format_tests-WMA.yaml; the Mathics
expectation for -4.326563712`2 in format_tests.yaml is updated to match).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…how the kept digits

These forms go through InputForm too, so they now show the digits that the
number keeps, as the text form does; WMA's MathML InputForm also shows
-4.326563712 (test/format/format_tests-WMA.yaml).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rocky

rocky commented Oct 21, 2026

Copy link
Copy Markdown
Member

LGTM

@rocky
rocky merged commit 57f78b0 into master Oct 21, 2026
15 checks passed
@rocky
rocky deleted the agent/MATH-260 branch October 21, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants