fix 𝕗⌾(-2⋆63)𝕩
This commit is contained in:
parent
e33b3b95ee
commit
bfce527096
@ -56,6 +56,10 @@ B catch_c1(Md2D* d, B x) { return c1(d->f, x); }
|
|||||||
B catch_c2(Md2D* d, B w, B x) { return c2(d->f, w,x); }
|
B catch_c2(Md2D* d, B w, B x) { return c2(d->f, w,x); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static NOINLINE NORETURN void repeat_bad_num() {
|
||||||
|
thrM("⍟: 𝔾 contained non-integer or integer was out of range");
|
||||||
|
}
|
||||||
|
|
||||||
extern GLOBAL B rt_undo;
|
extern GLOBAL B rt_undo;
|
||||||
void repeat_bounds(i64* bound, B g) { // doesn't consume
|
void repeat_bounds(i64* bound, B g) { // doesn't consume
|
||||||
#define UPD_BOUNDS(B,I) ({ i64 i_ = (I); if (i_<bound[0]) bound[0] = i_; if (i_>bound[1]) bound[1] = i_; })
|
#define UPD_BOUNDS(B,I) ({ i64 i_ = (I); if (i_<bound[0]) bound[0] = i_; if (i_>bound[1]) bound[1] = i_; })
|
||||||
@ -65,7 +69,7 @@ void repeat_bounds(i64* bound, B g) { // doesn't consume
|
|||||||
u8 ge = TI(g,elType);
|
u8 ge = TI(g,elType);
|
||||||
if (elNum(ge)) {
|
if (elNum(ge)) {
|
||||||
i64 bres[2];
|
i64 bres[2];
|
||||||
if (!getRange_fns[ge](tyany_ptr(g), bres, ia)) thrM("⍟: 𝔾 contained non-integer (or integer was out of range)");
|
if (!getRange_fns[ge](tyany_ptr(g), bres, ia)) repeat_bad_num();
|
||||||
if (bres[0]<bound[0]) bound[0] = bres[0];
|
if (bres[0]<bound[0]) bound[0] = bres[0];
|
||||||
if (bres[1]>bound[1]) bound[1] = bres[1];
|
if (bres[1]>bound[1]) bound[1] = bres[1];
|
||||||
} else {
|
} else {
|
||||||
@ -73,7 +77,7 @@ void repeat_bounds(i64* bound, B g) { // doesn't consume
|
|||||||
for (usz i = 0; i < ia; i++) repeat_bounds(bound, GetU(g, i));
|
for (usz i = 0; i < ia; i++) repeat_bounds(bound, GetU(g, i));
|
||||||
}
|
}
|
||||||
} else if (isNum(g)) {
|
} else if (isNum(g)) {
|
||||||
if (!q_i64(g)) thrM("⍟: 𝔾 contained non-integer (or integer was out of range)");
|
if (!q_i64(g)) repeat_bad_num();
|
||||||
i64 c = o2i64G(g);
|
i64 c = o2i64G(g);
|
||||||
if (c<bound[0]) bound[0] = c;
|
if (c<bound[0]) bound[0] = c;
|
||||||
if (c>bound[1]) bound[1] = c;
|
if (c>bound[1]) bound[1] = c;
|
||||||
@ -104,7 +108,8 @@ NOINLINE B repeat_replaceR(B g, B* q) {
|
|||||||
} \
|
} \
|
||||||
i64 bound[2] = {0,0}; \
|
i64 bound[2] = {0,0}; \
|
||||||
repeat_bounds(bound, g); \
|
repeat_bounds(bound, g); \
|
||||||
i64 min=(u64)-bound[0]; i64 max=(u64)bound[1]; \
|
i64 min=-(u64)bound[0]; i64 max=bound[1]; \
|
||||||
|
if ((min|max) >> 48 != 0) repeat_bad_num(); \
|
||||||
TALLOC(B, all, min+max+1); \
|
TALLOC(B, all, min+max+1); \
|
||||||
B* q = all+min; \
|
B* q = all+min; \
|
||||||
q[0] = inc(x); \
|
q[0] = inc(x); \
|
||||||
|
|||||||
@ -462,10 +462,11 @@ a←↕2 ⋄ ! "e" ≡ (↕10){b←a‿a‿a‿a‿a‿a‿a‿a‿a‿a ⋄
|
|||||||
!"⍟: 𝔾 contained non-number" % 1⊸+⍟⟨1,∘,3⟩ 0
|
!"⍟: 𝔾 contained non-number" % 1⊸+⍟⟨1,∘,3⟩ 0
|
||||||
!"Expected integer, got 1.5" % 1⊸+⍟1.5 0
|
!"Expected integer, got 1.5" % 1⊸+⍟1.5 0
|
||||||
!"Integer out of range: 1e20" % 1⊸+⍟1e20 0
|
!"Integer out of range: 1e20" % 1⊸+⍟1e20 0
|
||||||
!"⍟: 𝔾 contained non-integer (or integer was out of range)" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨1.5⟩
|
!"⍟: 𝔾 contained non-integer or integer was out of range" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨1.5⟩
|
||||||
!"⍟: 𝔾 contained non-integer (or integer was out of range)" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨1e20⟩
|
!"⍟: 𝔾 contained non-integer or integer was out of range" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨1e20⟩
|
||||||
!"⍟: 𝔾 contained non-integer (or integer was out of range)" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨9, 1.5⟩
|
!"⍟: 𝔾 contained non-integer or integer was out of range" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨9, 1.5⟩
|
||||||
!"⍟: 𝔾 contained non-integer (or integer was out of range)" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨1.5, 9⟩
|
!"⍟: 𝔾 contained non-integer or integer was out of range" % %USE evar ⋄ {1⊸+⍟𝕩 0}_evar ⟨1.5, 9⟩
|
||||||
|
!"⍟: 𝔾 contained non-integer or integer was out of range" % %USE eqerr ⋄ {1⊸+⍟𝕩‿𝕩 2}_eqerr -⊸∾ ⟨2⋆63, 2⋆60⟩
|
||||||
|
|
||||||
# ◶
|
# ◶
|
||||||
!"𝔽◶𝕘𝕩: 𝕘 must have rank 1 when index is a number" % 1◶[1‿2,3‿4] 3
|
!"𝔽◶𝕘𝕩: 𝕘 must have rank 1 when index is a number" % 1◶[1‿2,3‿4] 3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user