fix error message of usum of i32arr encountering a negative element
This commit is contained in:
parent
5c7ab3f9a8
commit
a439c64e85
@ -301,7 +301,7 @@ u64 usum(B x) { // doesn't consume; will error on non-integers, or elements <0,
|
||||
if (xe==el_bit) return bit_sum(bitarr_ptr(x), xia);
|
||||
else if (xe==el_i8 ) { i8* p = i8any_ptr (x); i8 m=0; for (usz i = 0; i < xia; ) { usz b=1<< 8; i16 s=0; for (usz e = xia-i<b?xia:i+b; i < e; i++) { m|=p[i]; s+=p[i]; } if (m<0) goto neg; if (addOn(r,(u16)s)) goto overflow; } }
|
||||
else if (xe==el_i16) { i16* p = i16any_ptr(x); i16 m=0; for (usz i = 0; i < xia; ) { usz b=1<<16; i32 s=0; for (usz e = xia-i<b?xia:i+b; i < e; i++) { m|=p[i]; s+=p[i]; } if (m<0) goto neg; if (addOn(r,(u32)s)) goto overflow; } }
|
||||
else if (xe==el_i32) { i32* p = i32any_ptr(x); i32 m=0; for (usz i = 0; i < xia; i++) { m|=p[i]; if (addOn(r,p[i])) goto overflow; } if (m<0) goto neg; }
|
||||
else if (xe==el_i32) { i32* p = i32any_ptr(x); i32 m=0; for (usz i = 0; i < xia; i++) { m|=p[i]; if (addOn(r,p[i])) { if (m<0) goto neg; else goto overflow; } } if (m<0) goto neg; }
|
||||
else if (xe==el_f64) {
|
||||
f64* p = f64any_ptr(x);
|
||||
for (usz i = 0; i < xia; i++) {
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
!"Didn't expect negative integer" % / 4/1000‿¯1000
|
||||
!"/: Argument must have rank 1 (3‿3 ≡ ≢𝕩)" % /↕3‿3
|
||||
!"/: Argument must have rank 1 (⟨⟩ ≡ ≢𝕩)" % /0
|
||||
%USE tvar ⋄ ∧⍷ /⎊•CurrentError _tvar ¯1⌾(100⊸⊑) 200⥊10 %% "Didn't expect negative integer"‿"Expected integer" # TODO shouldn't have different error messages
|
||||
! (//⁼)⊸≡8‿15‿25‿32‿90‿101‿155‿165‿584‿594‿894‿912‿1312‿1328‿1350‿1367‿1391‿1407‿1469‿1486‿1559‿1566‿1576‿1582‿1592‿1599‿1609‿1616‿1626‿1635‿4086‿4093‿4114‿4122‿4141‿4149‿4169‿4177
|
||||
|
||||
# 𝕨⊏𝕩
|
||||
|
||||
Loading…
Reference in New Issue
Block a user