Skip to content

Add option to shown approximate answer#22

Merged
douden merged 13 commits into
fixing_issuesfrom
evaluated-math
May 1, 2026
Merged

Add option to shown approximate answer#22
douden merged 13 commits into
fixing_issuesfrom
evaluated-math

Conversation

@Tom-van-Woudenberg

@Tom-van-Woudenberg Tom-van-Woudenberg commented Apr 30, 2026

Copy link
Copy Markdown
Member

Adds approximate answer to math questions. Example shown here: https://oit.tudelft.nl/CTB1310/test-evalf/sympy/lesoefening2.html

Tom-van-Woudenberg and others added 5 commits May 1, 2026 15:21
Clarify in README that E-modes must include a trailing `;<digits>` and provide an example showing how shown answers are formatted with the specified significant digits. Change _extract_evalf_from_answer to enforce this: it now raises a ValueError (including lineno and docname) when no valid trailing digits are provided instead of falling back to a default. This makes the formatting behavior explicit and fails fast on malformed answers.
Normalize math markup in examples: replace plain fractions with \frac/\dfrac, escape π as \pi, and wrap numeric significant-digit values in math mode ($5$, $6$). These changes update the displayed answers and input examples for clearer and more consistent LaTeX rendering (applied to two repeated examples).
Improve the ValueError message in QuestionDirective parsing: replace a vague "Invalid at ..." message with a more explicit "Invalid formatted digits at line ..." so the error more clearly identifies the issue and its location in the document.
Remove the DEFAULT_EVALF_SIG_DIGITS class attribute from QuestionDirective in src/teachbooks_questions/__init__.py. This cleans up an unused configuration constant; no functional changes are expected.
@douden douden merged commit 4bfc93f into fixing_issues May 1, 2026
3 checks passed
@douden douden deleted the evaluated-math branch May 1, 2026 19:55
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