Skip to content

Add a page on how precision and accuracy are implemented - #50

Merged
rocky merged 1 commit into
Mathics3:masterfrom
tombouctou:precision-and-accuracy
Oct 28, 2026
Merged

rocky merged 1 commit into
Mathics3:masterfrom
tombouctou:precision-and-accuracy

Conversation

@tombouctou

@tombouctou tombouctou commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Following the suggestion in Mathics3/mathics-core#2067: the developer side of the precision work in mathics-core #2050–#2067. The user side is in the Manual, Mathics3/mathics-core#2069.

A new page, code-overview/precision-and-accuracy, placed after "Rules" in the Code Overview:

  • Numbers: MachineReal versus PrecisionReal, and PrecisionReal's _precision10 (a decimal precision that can be any real number) and _extended (64 bits of a low-precision value). It also says which property to read where (precision / precision10, value / extended_value) and why to use from_value.
  • Where errors are worked out: eval_add_numbers / eval_multiply_numbers; the guard digits numerify gives exact constants; MPMathFunction.condition_numbers and eval_mpmath_function_by_condition; _change_within for zero values and zero arguments; special_point_value / indeterminate_at; complex parts; the second pass of N with $MaxExtraPrecision; SetPrecision.
  • Adding precision to a new function: a short checklist.
  • Not done yet: the cases that still take the old path.

sphinx-build -b html docs: no warning mentions the new page, and the build gives no more warnings than master does.

🤖 Generated with Claude Code

How the kernel tracks the error of arbitrary-precision numbers, as WMA
does: PrecisionReal's decimal precision and 64-bit value, the error
rules for sums and products, condition numbers for functions, zero
values, special points, complex parts, the second pass of N, and
SetPrecision. Ends with how to add precision to a new function.

The user-level description is in the Mathics3 Manual
(Mathics3/mathics-core#2069).

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

rocky commented Oct 28, 2026

Copy link
Copy Markdown
Member

LGTM - thanks!

@rocky
rocky merged commit 8f057f2 into Mathics3:master Oct 28, 2026
@rocky

rocky commented Oct 28, 2026

Copy link
Copy Markdown
Member

I will be going looking over these docs for content and stupid stuff. (Grammarly-kind of punctuation, phrasing, and spelling. It is a little drier, but so be it.)

So there will probably be small changes to this text and other text.

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