A one-cent discrepancy can survive a surprisingly careful code review. Every variable may use Decimal, every output may display two places, and every example in the ticket may pass. The missing detail is often a policy decision: which intermediate value gets rounded, which tie wins, or which recipient receives an indivisible remainder. Decimal calculations become reviewable when those choices are written down and tested separately from the implementation.
This tutorial uses DeepSeek as a collaborator for reviewing that policy and proposing difficult tests. The numerical evidence comes from executable Python and an independent rational oracle. No DeepSeek response or API execution is represented as having occurred. The accompanying lab implements a deliberately small software contract: bounded decimal-string inputs, half-even cent rounding, a staged synthetic calculation, and exact allocation of an integer-cent total. The discount and tax labels belong to a toy software example; this is not legal, tax, or financial guidance.
Write the rounding contract before asking for code
Start with the decisions a reviewer should be able to find without reading an implementation. What counts as an input? What is the smallest output unit? Where are intermediate amounts rounded? What happens to a negative amount? How are leftovers assigned? These questions describe observable behavior. A request to “calculate accurately” leaves all of them open, giving both a developer and a model room to invent incompatible answers.
For this lab, a decimal input is a built-in string of ASCII digits with an optional minus sign, an integer part, and an optional fractional part. The integer part has at most twelve digits; the fractional part has between one and six digits when present. Leading zeros are forbidden except for the integer zero itself. There is no plus sign, exponent notation, whitespace, grouping separator, or implicit decimal point. These restrictions make boundary cases small enough to enumerate and resource limits easy to inspect.
Rounding returns a Decimal value at cent scale using half-even ties; the demo renders it with exactly two fractional digits. A result equal to zero is normalized to 0.00, including when a small negative input rounds to zero. The staged example accepts nonnegative amounts and percentage strings between zero and one hundred, inclusive. Its calculation order is part of the contract. A future change to that order deserves the same review as a changed formula, even when familiar examples still return the same total.
The allocation contract starts after an amount has become integer cents. It accepts a nonnegative total, a nonempty ordered sequence of positive integer weights, and bounded sizes. Remaining cents go to the largest fractional remainders; equal remainders favor earlier input positions. That last sentence is a product decision with visible consequences. Record it beside the arithmetic rule, rather than allowing an incidental dictionary order or sorting implementation to decide who receives a cent.
Preserve the value at the string boundary
Consider an input amount written as 42.105. The application needs to decide what those characters mean before performing any arithmetic. In this lab they identify an exact decimal value whose half-even cent result is 42.10. Sending that value through a floating-point field first introduces another representation into the path. Converting a later value back to a string cannot establish that the original characters survived unchanged.
Python’s floating-point tutorial explains that many familiar decimal fractions have approximate binary representations and that display formatting can conceal the approximation. That is a reason to inspect the entire input path. A decimal calculation can begin in a web form, cross a JSON boundary, enter a job payload, and only then reach Python. A Decimal constructor at the last step does not repair an earlier loss of the original decimal text.
The lab therefore rejects numeric Python objects at its public decimal boundary. A float, integer, Boolean, or preconstructed Decimal is not an accepted substitute for the specified string. This may feel strict for an integer such as 12, but it makes the interface unambiguous: callers either supply the agreed textual representation or receive a validation error. A separate adapter can translate a different trusted representation under its own explicit rules.
Separate syntax rejection from domain rejection. The string -1.25 is valid syntax and a useful rounding input, while the toy subtotal function rejects it as an amount. The string 01.25 fails syntax before any business rule is evaluated. Keeping these distinctions visible helps a client return a useful error and gives tests a clear target. Silently trimming, normalizing, or guessing malformed text would create behavior outside this lab’s contract.
Make the arithmetic environment explicit
The relevant Python Decimal mechanisms are compact: constructing from a decimal string preserves its specified digits; quantize selects a target exponent; and an arithmetic context controls precision, rounding, exponent limits, and traps. A local context can isolate a calculation. Precision counts significant digits rather than decimal places, and signal flags persist until cleared. The Python reference linked below documents these behaviors. The lab’s particular settings and rounding stages are design choices, tested against its own bounded inputs.
The implementation creates an explicit context with precision forty, half-even rounding, and exponent limits of minus ninety-nine and ninety-nine. It explicitly enables the invalid-operation, division-by-zero, and overflow traps. Expected rounding remains permitted. This context is supplied inside each calculation rather than assuming that a caller, a notebook cell, or another imported module has left suitable settings behind. The purpose is a reproducible environment whose relevant settings a reviewer can inspect together.
A useful hostile test changes the caller’s precision to a very small value and selects a different rounding mode before invoking the public function. The returned value and its two-place representation should remain unchanged, and the caller’s settings should still be intact afterward. The lab also exercises an altered default context before a fresh import. Together these checks address two separate dependencies: settings present when a module loads and settings active when an individual calculation runs.
Do not confuse isolation with unlimited capacity. Forty digits are adequate only because this example constrains both its inputs and its operations. Adding compound interest, repeated division, unlimited line items, or arbitrary exchange rates would require a new analysis. A reviewer should ask which bound makes the precision safe and which new operation could invalidate that reasoning. “We chose a large number” is an assumption to investigate, not a durable explanation.
Test ties on both sides of zero
Midpoints, neighbors, and canonical zero
Half-even selects the nearest cent and resolves an exact halfway case toward an even cent count. Thus 42.105 becomes 42.10, while 42.115 becomes 42.12. The distinguishing detail is the parity of the neighboring cents, not merely whether the first discarded digit is five. These two examples belong together because an implementation that always rounds a midpoint upward would pass one and fail the other.
Negative inputs deserve their own fixtures. Under this contract, -42.105 becomes -42.10 and -42.115 becomes -42.12. Add values immediately around a tie, such as 42.104999 and 42.105001, to establish which side of the boundary they occupy. A suite consisting entirely of positive, comfortably non-midpoint values can leave the sign handling and tie decision almost completely untested.
Then test the zero boundary as a formatting decision. The input -0.005 rounds to the numerical value zero and is serialized as 0.00. The input -0.005001 rounds to -0.01. Keeping both cases prevents a tempting but incorrect cleanup that simply removes minus signs from small values. Zero normalization should apply to a rounded result equal to zero, not to a loosely defined range of inputs.
Trace the synthetic subtotal, discount, and tax stages
The worked calculation begins with the amount string 19.995, a discount percentage of 12.5, and a tax percentage of 7.5. First, the amount is rounded to the subtotal 20.00. The discount is calculated from that rounded subtotal: 20.00 multiplied by 12.5 and divided by one hundred gives 2.50. Subtracting the rounded discount gives the net amount 17.50.
The tax stage uses that net amount. Multiplying 17.50 by 7.5 and dividing by one hundred produces the unrounded value 1.3125, which rounds to 1.31. The final total is the cent-valued net plus the cent-valued tax, producing 18.81. The returned record exposes subtotal, discount, net, tax, and total so the test can identify the first divergent stage rather than reporting only an unexplained final mismatch.

Every displayed stage corresponds to a rule in the contract. The net subtraction already operates on cent-valued quantities, so it is exact at the chosen scale within these bounds. The implementation therefore performs the subtraction without another quantization. The final addition likewise combines two cent-valued amounts. Both results retain cent scale in this lab. Tests check that scale along with numerical equality, which would otherwise overlook a change in representation.
A smaller example makes the policy difference easier to see. Start with 0.05, a ten percent discount, and a ten percent tax. The raw discount is 0.005, which rounds half-even to 0.00. The net remains 0.05, and its raw tax is again 0.005, also rounded to 0.00. The staged total is therefore 0.05. Each intermediate result is defensible only because the contract states where rounding occurs.
Contrast that with a separately specified formula that computes the discounted value first and rounds it before applying tax. Five cents multiplied by 0.9 gives 0.045, which rounds half-even to 0.04. A ten percent tax then rounds from 0.004 to 0.00, yielding 0.04. Neither calculation settles the policy question by itself. The one-cent difference is evidence that apparently equivalent arithmetic rearrangements can change this program’s promised behavior.
Do not move a rounding point during refactoring
Another short counterexample concerns aggregation. Rounding two separate inputs of 0.005 yields 0.00 and 0.00, whose sum is 0.00. Adding the original values first gives 0.010, which rounds to 0.01. If a later feature introduces line items, the existing subtotal helper does not decide whether to round individual lines or their combined amount. That choice needs a new requirement and a fixture that preserves the intended order.
Use these examples when reviewing an optimization that combines expressions. Removing an intermediate variable can look harmless in a diff, while removing its associated quantization changes the calculation. Ask the reviewer to mark each rounding boundary before comparing the old and new expressions. A permitted algebraic rewrite must preserve those boundaries or carry explicit approval for a policy change.
Explain the precision budget with bounded arithmetic
An accepted amount can contain twelve integer digits and six fractional digits. Its largest positive value sits just below one trillion, and rounding that value can produce a subtotal of exactly one trillion. This carry is important: the output may require an additional integer digit even though the input grammar does not accept that larger integer. Input validation and the space required for internal results are different bounds.
The lab’s percentages are limited to one hundred, with at most six fractional digits. After subtotal rounding, the calculation multiplies a cent-valued amount by such a percentage and divides by one hundred. Division by this particular power of ten terminates exactly. These operations need far fewer than forty significant digits before the deliberately selected cent rounding. The tax can reach the net amount, so the final total can reach two trillion under this synthetic contract.
This reasoning supplies targeted upper-bound tests: the largest accepted amount, its rounded carry, a full discount, and a full tax. It also explains why the allocation function’s separate total bound is checked independently. A future developer widening the input grammar should update the precision argument and these boundary fixtures together. Keeping that relationship explicit is more useful than merely increasing precision until a failing example disappears.
Keep the executable core small enough to inspect
The download contains the implementation, a demonstration, and a test suite. Its public entry points are parse_decimal, round_cents, toy_total, and allocate_cents. The parser owns textual validation; the rounding helper owns output scale; the staged function owns calculation order; and the allocator owns conservation of cents. Those responsibilities make it possible to review one policy boundary at a time without hiding decisions inside a large convenience function.
Read the code beside the contract before running the tests. Locate every quantization, every conversion, and every place that depends on input ordering. Then check whether the error paths match the allowed domain. Small code still needs evidence, but a compact implementation makes discrepancies easier to explain in a review comment and easier to reproduce with a minimal input.
Download the complete decimal calculation lab and reproducible tests (ZIP). The lab uses only the Python standard library. Extract it, then run python3 -m unittest -v test_decimal_lab.py and python3 demo.py from the extracted folder.
"""Synthetic decimal-calculation exercises, not financial or tax advice."""
import re
from decimal import (
Context, Decimal, DivisionByZero, InvalidOperation, Overflow,
ROUND_HALF_EVEN, localcontext,
)
_TEXT = re.compile(r"-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,6})?")
_CENT, _HUNDRED = Decimal("0.01"), Decimal("100")
_WORK = Context(
prec=40, rounding=ROUND_HALF_EVEN, Emin=-99, Emax=99,
capitals=1, clamp=0, flags=[],
traps=[InvalidOperation, DivisionByZero, Overflow],
)
MAX_CENTS, MAX_WEIGHT, MAX_PARTS = 10**15, 10**9, 1000
def parse_decimal(text):
"""Accept only plain strings: <=12 integer and <=6 fractional digits."""
if type(text) is not str:
raise TypeError("Pass a decimal string, never a float or boolean")
if len(text) > 20 or _TEXT.fullmatch(text) is None:
raise ValueError("Use plain decimal notation within the digit limits")
return Decimal(text)
def _cents(value):
rounded = value.quantize(_CENT, rounding=ROUND_HALF_EVEN)
return rounded if rounded else Decimal("0.00")
def round_cents(text):
"""Half-even to two places; normalize negative zero to 0.00."""
value = parse_decimal(text)
with localcontext(_WORK):
return _cents(value)
def toy_total(amount, discount_pct, tax_pct):
"""Round subtotal, discount and tax separately; tax the discounted net."""
amount, discount_pct, tax_pct = map(
parse_decimal, (amount, discount_pct, tax_pct)
)
if amount < 0 or not 0 <= discount_pct <= 100 or not 0 <= tax_pct <= 100:
raise ValueError("Amount must be nonnegative; rates must be in [0, 100]")
with localcontext(_WORK):
subtotal = _cents(amount)
discount = _cents(subtotal * discount_pct / _HUNDRED)
net = subtotal - discount
tax = _cents(net * tax_pct / _HUNDRED)
return dict(subtotal=subtotal, discount=discount, net=net,
tax=tax, total=net + tax)
def allocate_cents(total_cents, weights):
"""Largest remainders win; equal remainders favor the earlier index."""
if type(total_cents) is not int:
raise TypeError("total_cents must be an integer, not a boolean")
if not 0 <= total_cents <= MAX_CENTS:
raise ValueError("total_cents is outside the supported range")
if type(weights) not in (list, tuple):
raise TypeError("weights must be a list or tuple")
if not 1 <= len(weights) <= MAX_PARTS:
raise ValueError("Supply between 1 and 1000 weights")
if any(type(w) is not int for w in weights):
raise TypeError("Each weight must be an integer, not a boolean")
if any(not 1 <= w <= MAX_WEIGHT for w in weights):
raise ValueError("Each weight must be between 1 and 1000000000")
denominator = sum(weights)
pairs = [divmod(total_cents * w, denominator) for w in weights]
parts = [quotient for quotient, _ in pairs]
remaining = total_cents - sum(parts)
order = sorted(range(len(weights)), key=lambda i: (-pairs[i][1], i))
for i in order[:remaining]:
parts[i] += 1
return parts
Allocate indivisible cents with integer remainders
Suppose ten cents must be divided among three recipients with equal weights. Each ideal quota is ten thirds of a cent. Independently rounding every quota to three cents leaves a missing cent; rounding every quota upward creates two extra cents. The requirement is different from rounding isolated values: produce whole-cent allocations whose sum is exactly ten while staying close to each recipient’s weighted share.
The lab uses the largest-remainder method. For each recipient, multiply the total cents by its weight and divide by the sum of all weights using integer quotient and remainder. The quotient supplies that recipient’s initial allocation. Add the initial allocations, subtract their sum from the total, and distribute the remaining cents to the recipients with the largest remainders. Each selected recipient receives one additional cent.

For ten cents and weights [1, 1, 1], the initial allocations are [3, 3, 3]. One cent remains. All three remainders are equal, so the explicit input-order rule gives that cent to the first recipient, producing [4, 3, 3]. There is no floating-point approximation and no decimal precision setting in this computation. The comparisons use integer remainders with a common denominator, so comparing the numerators suffices.
A less symmetrical case is eleven cents with weights [5, 3, 2]. The ideal shares are 5.5, 3.3, and 2.2 cents. Their floors sum to ten, leaving one cent; the largest remainder belongs to the first share, giving [6, 3, 2]. This example exercises the ranking rule, while the equal-weight example exercises the tie rule. Keeping both makes it harder for a stable-looking but incorrect sorting strategy to pass.
The code accepts totals up to ten to the fifteenth cents, between one and one thousand weights, and individual weights from one through one billion. It rejects Booleans even though Python permits them in many integer operations. These are application limits, chosen to keep the contract bounded. They also help separate an unsupported request from a numerical defect when a caller submits an unexpectedly large job.
Why a single pass over spare cents is enough
Each ideal share equals its integer floor plus a fractional part smaller than one. Because the ideal shares sum to the original integer total, the sum of those fractional parts is exactly the number of spare cents. For a nonempty list of recipients, that number is at least zero and strictly smaller than the number of recipients. The allocator therefore never needs to give any recipient more than one remainder cent.
This argument explains the implementation’s slice of the ranked recipients. It also supplies a debugging invariant: if a proposed version reports as many spare cents as recipients, something earlier is wrong. Inspect the quotient calculation, the total, and the weight denominator before changing the distribution loop. A compensating loop that repeatedly adds cents may conceal an incorrect foundation while still making the final sum appear correct.
Distinguish conservation from stronger promises
Exact conservation is the first allocation invariant: the integer outputs must sum to the original total. Nonnegativity is the second. Each allocation must also be either the floor or the ceiling of its ideal quota. Together those checks establish important behavior, yet they do not prove that the correct recipients received the spare cents. An implementation could satisfy all three while using the wrong tie-break or remainder order.
Test the ranking explicitly. Multiplying every weight by the same positive integer should leave the result unchanged when the scaled weights remain valid. Reordering recipients without a remainder tie should carry allocations along with their identities. With a tie, the input-order policy intentionally affects who receives a spare cent. Tests need to distinguish those situations rather than imposing unconditional permutation invariance that contradicts the documented behavior.
Do not promise broader fairness properties without checking them. Under this rule, increasing a total can reduce one recipient’s allocation: weights [5, 3, 1] allocate four cents as [2, 1, 1], but five cents as [3, 2, 0]. The last recipient loses its earlier remainder cent. That result matters if a product expects each share to grow with the total. The lab promises conservation and its stated quota rule, not every intuitive notion of fairness.
Build an oracle that does not reuse the implementation
Compute expected cents through rational arithmetic
A strong expected-value generator should reach the answer by another route. The lab constructs fractions.Fraction values from valid decimal strings, multiplies by one hundred, and uses rational half-even rounding to obtain integer cents. For example, 42.105 represents 42105 over 1000 before reduction. The Fraction reference documents its rounding behavior. This oracle never calls the production rounding helper or performs its calculations through Decimal.
The rational midpoint decision also has a short hand-checkable derivation. Compare twice the remainder with the denominator. A smaller result keeps the quotient; a larger result increments it. Equality is the tie case, where an odd quotient is incremented and an even quotient remains unchanged. Work on the absolute magnitude and restore the sign afterward. Finally, construct the two-place string from the signed integer-cent result, applying the agreed zero normalization.
For staged totals, the rational oracle follows the same written policy while using its own arithmetic. It rounds the original amount to cents, computes and rounds the discount, subtracts the resulting cents, and then computes and rounds tax. Sharing the policy is necessary; sharing the production helper would undermine independence. If both paths call the same faulty quantization wrapper, agreement says little about whether that wrapper implements the contract.
Independence also has limits. Two implementations can inherit the same mistaken policy description or both omit the same invalid input. Keep a small set of manually explained fixtures, such as the midpoint pair and five-cent staged example, alongside generated comparisons. Ask a reviewer to challenge those expected values before reading the code. The goal is several different opportunities to expose an error, not a large count of mutually dependent assertions.
Design tests around failure mechanisms
Organize the suite by what could go wrong. Boundary tests reject forbidden syntax and types. Rounding tests cover even and odd ties, neighboring values, negative values, and zero normalization. Pipeline tests assert every returned stage. Allocation tests cover conservation, quota bounds, remainder ranking, and deterministic ties. Environment tests perturb the surrounding decimal context. A failing group then points to a likely policy boundary instead of leaving a reviewer to interpret an undifferentiated test list.
Use systematic small cases where exhaustive coverage is affordable. Small totals and short weight vectors reveal allocation mistakes quickly because the expected outcomes remain inspectable. Add seeded larger cases to exercise different magnitudes and weight ratios, keeping the seed and input available on failure. For decimal rounding, generate finite decimal strings directly so the test does not accidentally introduce the floating-point conversion path the public interface forbids.
Include rejected near-misses deliberately: an empty string, a trailing decimal point, a leading plus sign, a seventh fractional digit, a thirteenth integer digit, a nonfinite token, and a whitespace-padded amount. The allocator needs empty sequences, zero and negative weights, oversized inputs, and Boolean values. Each case should fail through the documented validation path. Accepting an unexpected representation can be as meaningful a regression as returning a wrong cent.
Finally, make plausible defects visible to the suite. Temporarily switch half-even to half-up, remove subtotal rounding, reverse the allocation tie order, or let the caller’s context leak into arithmetic. Each alteration should trigger an appropriate test. These targeted mutations are useful review exercises because they ask whether the evidence can distinguish the implementation from realistic wrong alternatives. A green run alone cannot answer that question.
Read test counts as evidence with a scope
The accompanying suite includes generated comparisons for one thousand rounding inputs and seven hundred staged calculations. It also checks ten thousand five hundred forty small allocations exhaustively within its selected ranges, plus five hundred seeded larger allocations. These are cases executed inside named tests. They strengthen coverage of the bounded lab, but they do not establish correctness for a different input grammar, a different stage order, or an expanded numerical domain.
Keep the exact test command, runtime version, and result with the code snapshot you reviewed. If a model proposes another fixture after that run, the earlier result does not verify the new fixture or a changed implementation. Rerun the suite and keep a concise record of what changed. The artifact to trust is the reproducible combination of source, inputs, expected outputs, and execution evidence.
Give DeepSeek a bounded review assignment
Provide the contract, core implementation, selected fixtures, and current test output together. Ask DeepSeek to identify a specific mismatch or propose a minimal counterexample for each concern. Require it to separate a policy question from an implementation defect. That separation prevents a review from quietly replacing the chosen rounding stages with the model’s preferred convention and then describing the original behavior as a bug.
Review this bounded decimal-calculation contract and implementation. Separate policy ambiguities, code defects, and missing tests. For every alleged defect, cite the relevant function and give the smallest input that demonstrates it. Do not invent an execution result. Explain which proposed tests need an independently calculated expected value.
A second pass can concentrate on the oracle. Supply its code separately and ask where it shares logic with production, which sign cases it might mishandle, and whether it can represent every accepted input exactly. The model’s proposed counterexample becomes a candidate test. Calculate its expected result independently, run it, and retain the evidence if it reveals a real gap. Plausibility is a starting point for verification.
Challenge this rational oracle without calling the production rounding helpers. Examine midpoint parity, negative inputs, canonical zero, bounded input parsing, and each staged rounding point. Propose at most five discriminating cases and explain what incorrect implementation each would expose. Label all unexecuted predictions as predictions.
For broader review structure, the site’s guide to DeepSeek code review complements this narrow arithmetic assignment. The property-based testing guide is useful when expanding generated cases, while requirements analysis can help turn an unresolved rounding choice into an explicit acceptance criterion. Keep the decimal policy attached to any later review so its assumptions travel with the code.
Preserve the contract across integration boundaries
A correct helper can still be integrated incorrectly. Trace the amount from its original field to the response or stored record. Check that request validation, queue serialization, database mapping, and response construction all preserve the intended representation. Test an end-to-end midpoint value rather than assuming that unit tests prove the surrounding path. An adapter that converts the string to a number and back deserves special attention.
Keep calculation values distinct from display labels. The calculation functions return Decimal objects at a fixed scale; an explicit serializer can turn those results into decimal-point strings, and a presentation layer may render them differently for a user. That rendered label should not be parsed back into the calculation without a separate, specified input policy. The same distinction applies to percentages: the lab receives 7.5 to mean seven and a half percent, rather than receiving the fractional multiplier 0.075.
Allocation inputs also need stable identity. Associate each weight with a recipient before calling the allocator, preserve the ordered mapping, and attach each returned cent count to that same recipient afterward. Sorting labels for display must not silently change the tie priority of a later recalculation. If product requirements call for another priority, define and version that ordering rule before changing the data preparation step.
Keep evidence that explains a disputed cent
Record enough to reproduce the policy decision
A useful calculation record can answer a concrete question: why did this input produce this total under this policy? Preserve the policy version, validated input strings, rounding mode, relevant context configuration, staged outputs, and implementation version. For allocations, retain the total cents, ordered weights or their authorized identifiers, remainder priority, and final shares. This is an evidence design proposal, not a suggestion to log every surrounding customer field.
Choose storage and retention according to the application’s actual privacy requirements. A synthetic reproduction usually needs numerical inputs and policy metadata, not names, addresses, or account details. Avoid pasting private transaction records into a model review merely because the arithmetic is difficult. Reproduce the same boundary with fabricated values when possible, and follow the organization’s approved rules whenever real data is necessary.
During deployment, compare a proposed implementation with the existing policy on an authorized representative sample before changing live calculations. Classify differences by their first divergent stage. A changed discount may explain both a changed tax and total; counting those as three unrelated failures obscures the cause. Require an explicit policy decision for intentional differences, and retain a reproducible regression case for each defect that the comparison uncovers.
Plan replay before changing a rounding rule
Decide whether recalculating an older record should use its original policy version or the newly deployed policy. Both behaviors may be useful in different workflows, but an unexplained mixture makes reconciliation difficult. A replay operation should identify its selected policy explicitly and preserve the original result when comparison is the goal. Changing a version label without retaining the associated calculation rules does not make a historical total reproducible.
Keep rollback equally concrete. If the new implementation produces unexpected differences, preserve the evidence, restore the approved calculation path, and determine whether already produced results require review. Avoid silently overwriting stored totals merely to make a comparison pass. The required correction process belongs to the surrounding application; this lab provides the numerical building blocks and reproducible examples, not authority to alter real records.
Release the policy and its tests together
The release unit is larger than a helper function. It includes the accepted grammar, bounds, stage order, tie rules, serialization format, oracle, fixtures, and evidence needed to reproduce a result. A clean review should let another developer explain 18.81 in the worked calculation and [4, 3, 3] in the allocation without trusting a model’s answer. That is the practical standard this lab is designed to support.
DeepSeek can help challenge assumptions, locate untested branches, and formulate counterexamples for this workflow. Treat each suggestion as a review input and turn accepted findings into executable evidence. When a policy changes, revise the contract and expected results deliberately. Keeping that chain visible makes a one-cent disagreement something a team can investigate and resolve rather than an unexplained difference hidden behind a formatted total.
Sources & References
- Python documentation: Decimal arithmetic, contexts, rounding, and signals. Reference for the library mechanisms used by the lab.
- Python tutorial: Floating-point arithmetic issues and limitations. Background on binary representation and formatted output.
- Python documentation: Fraction rational arithmetic and rounding. Reference for the independent expected-value path in the tests.
- DeepSeek API documentation. Official integration reference if the review workflow is later automated; the lab requires no API calls.

[…] them upstream and test the resulting score representation. For exact monetary work, the separate DeepSeek decimal calculations guide addresses a different numeric […]