Skip to content

Add # Why largest-remainder? section to calc.rs module doc #641

Description

@Kingsman-99

Description

contracts/split/src/calc.rs has a terse //! comment but does not explain why the largest-remainder method is used over simple floor division. Adding a //! # Why largest-remainder? section explaining rounding and the sum == total invariant would make the module self-sufficient for new contributors.

Acceptance Criteria

  • Expand the //! module doc in contracts/split/src/calc.rs with a # Why largest-remainder? section
  • Explain: floor division leaves up to n-1 stroops undistributed; LR assigns them to recipients with the largest fractional remainders
  • Include a one-line numeric example (e.g. distributing 10 among 3 equal shares gives [4, 3, 3])
  • cargo doc builds without warnings
  • cargo test passes

Context

  • Target file: contracts/split/src/calc.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: highComplex feature requiring deep knowledge - 200 ptsdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions