test(core): the control harnesses prove None only on overflow; i32/i64 checked_sub is native
The tightened harnesses assert Some whenever every i128 prefix fits in i64. That found the default Amount::checked_sub refusing x - MIN on i32/i64 where the difference fits; both now use the native subtraction. The bridge pins aging_total(0,0,0,0,MAX) to Some(MAX), bounds the rounded figures to one unit of the exact value, and covers scales 0..=28. Two smaller worksheet harnesses (nine terms on i32, seven on i32) found no verdict in 400 s and 300 s: recorded, no harness. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
632a1a543c
commit
c8cfd32723
4 files changed
+95
-28
No files matched your search
@@ -180,6 +180,12 @@ impl Amount for i32 {
|
||||
fn checked_add(self, rhs: Self) -> Option<Self> {
|
||||
i32::checked_add(self, rhs)
|
||||
}
|
||||
// The native subtraction: the default negates `rhs` first and so
|
||||
// refused `x - MIN` even where the difference fits (found by the
|
||||
// K-U8 harnesses: `None` must mean overflow, and only overflow).
|
||||
fn checked_sub(self, rhs: Self) -> Option<Self> {
|
||||
i32::checked_sub(self, rhs)
|
||||
}
|
||||
fn checked_neg(self) -> Option<Self> {
|
||||
i32::checked_neg(self)
|
||||
}
|
||||
@@ -234,6 +240,12 @@ impl Amount for i64 {
|
||||
fn checked_add(self, rhs: Self) -> Option<Self> {
|
||||
i64::checked_add(self, rhs)
|
||||
}
|
||||
// The native subtraction: the default negates `rhs` first and so
|
||||
// refused `x - MIN` even where the difference fits (found by the
|
||||
// K-U8 harnesses: `None` must mean overflow, and only overflow).
|
||||
fn checked_sub(self, rhs: Self) -> Option<Self> {
|
||||
i64::checked_sub(self, rhs)
|
||||
}
|
||||
fn checked_neg(self) -> Option<Self> {
|
||||
i64::checked_neg(self)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user