docs(zset): drop the withdrawn premise from the overflow paragraph (improvise-tk51)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
Claude (adr009-zset)
2026-10-10 00:04:24 -07:00
committed by Edward Langley
parent 6de889a116
commit d1665f6499
+4 -4
View File
@@ -59,9 +59,8 @@ These are the readings this step takes.
is required only where a result copies keys (`filter`, `distinct`, `scale`, the borrowed is required only where a result copies keys (`filter`, `distinct`, `scale`, the borrowed
operators); `map` and the by-value operators need only `Ord`. operators); `map` and the by-value operators need only `Ord`.
5. **Overflow.** Neither clause 1 nor clause 8 states a policy for weights (clause 8 is about 5. **Overflow.** Neither clause 1 nor clause 8 states a policy for weights (clause 8 is about
`f64` sums). A weight that wraps would turn a retraction into an insertion with nothing `f64` drift, which wrapping integers do not have). The crate currently uses `checked_*`
to show it, which is the failure the ADR's exactness argument is against. So every weight on every weight operation, for the reason given below, and **panics** with `zset: weight overflow in <op>`, in debug
operation uses `checked_*` and **panics** with `zset: weight overflow in <op>`, in debug
and in release (`checked_*` does not depend on `overflow-checks`). The operations are and in release (`checked_*` does not depend on `overflow-checks`). The operations are
`add` (including `insert`, `Extend`, `FromIterator`), `sub`, `neg` (so `i64::MIN` panics `add` (including `insert`, `Extend`, `FromIterator`), `sub`, `neg` (so `i64::MIN` panics
when it has to be negated) and `scale`. Scaling by zero cannot overflow and returns the when it has to be negated) and `scale`. Scaling by zero cannot overflow and returns the
@@ -79,7 +78,8 @@ These are the readings this step takes.
under wrapping. (An earlier version of this paragraph said otherwise; that was wrong.) What under wrapping. (An earlier version of this paragraph said otherwise; that was wrong.) What
wrapping breaks is the intermediate reads. `MAX + 1` stores `i64::MIN`, so `distinct` wrapping breaks is the intermediate reads. `MAX + 1` stores `i64::MIN`, so `distinct`
drops a key whose true weight is positive and `weight()` has the wrong sign. A true weight drops a key whose true weight is positive and `weight()` has the wrong sign. A true weight
of 2^64 stores as 0, so the key vanishes and `is_zero`, `len` and `==` report a set that of 2^64 stores as 0 (by the add path; a `scale` product of 2^64 would store a zero too, which
breaks canonical form), so the key vanishes and `is_zero`, `len` and `==` report a set that
does not exist. Those are wrong answers returned silently, which is why the crate panics does not exist. Those are wrong answers returned silently, which is why the crate panics
instead. A wider weight (`i128`) moves the boundary and does not remove it. The ADR's instead. A wider weight (`i128`) moves the boundary and does not remove it. The ADR's
"abelian group" wording needs amending whichever policy is chosen: checked-and-panic gives "abelian group" wording needs amending whichever policy is chosen: checked-and-panic gives