clean up some error messages
This commit is contained in:
parent
ca90c6cb89
commit
9951f20751
@ -36,7 +36,7 @@ B add_c1(B t, B x) {
|
||||
|
||||
#define GC1i(SYMB,NAME,FEXPR,TMIN,RMIN,MAIN) B NAME##_c1(B t, B x) { \
|
||||
if (isF64(x)) { f64 v = x.f; return m_f64(FEXPR); } \
|
||||
if (RARE(!isArr(x))) thrM(SYMB ": Expected argument to be a number"); \
|
||||
if (RARE(!isArr(x))) thrM(SYMB ": Argument contained non-number"); \
|
||||
u8 xe = TI(x,elType); \
|
||||
if (elNum(xe)) { \
|
||||
if (xe<=TMIN) return RMIN; \
|
||||
@ -113,8 +113,8 @@ GC1i("¬", not, 1-v, el_bit, bit_negate(x), NOT_BODY)
|
||||
thrM(MSG); \
|
||||
}
|
||||
|
||||
GC1f( div, 1/xv, "÷: Getting reciprocal of non-number")
|
||||
GC1f(root, sqrt(xv), "√: Getting square root of non-number")
|
||||
GC1f( div, 1/xv, "÷: Argument contained non-number")
|
||||
GC1f(root, sqrt(xv), "√: Argument contained non-number")
|
||||
#undef GC1i
|
||||
#undef LOOP_BODY
|
||||
#undef SIGN_EXPR
|
||||
@ -143,8 +143,8 @@ NOINLINE f64 logfact_inv(f64 y) {
|
||||
f64 fact_inv(f64 y) { return logfact_inv(log(y)); }
|
||||
|
||||
#define P1(N) { if(isArr(x)) { SLOW1("arithm " #N, x); return arith_recm(N##_c1, x); } }
|
||||
B pow_c1(B t, B x) { if (isF64(x)) return m_f64( exp(x.f)); P1( pow); thrM("⋆: Getting exp of non-number"); }
|
||||
B log_c1(B t, B x) { if (isF64(x)) return m_f64( log(x.f)); P1( log); thrM("⋆⁼: Getting log of non-number"); }
|
||||
B pow_c1(B t, B x) { if (isF64(x)) return m_f64( exp(x.f)); P1( pow); thrM("⋆: Argument contained non-number"); }
|
||||
B log_c1(B t, B x) { if (isF64(x)) return m_f64( log(x.f)); P1( log); thrM("⋆⁼: Argument contained non-number"); }
|
||||
#undef P1
|
||||
static NOINLINE B arith_recm_slow(f64 (*fn)(f64), BB2B rec, B x, char* s) {
|
||||
if (isF64(x)) return m_f64(fn(x.f));
|
||||
|
||||
@ -372,7 +372,7 @@ B select_ucw(B t, B o, B w, B x) {
|
||||
if (TI(w,elType)!=el_i32) for (usz i = 0; i < wia; i++) if (!q_i64(GetU(w,i))) return def_fn_ucw(t, o, w, x);
|
||||
B arg = select_c2(t, inc(w), inc(x));
|
||||
B rep = c1(o, arg);
|
||||
if (isAtm(rep) || !eqShape(w, rep)) thrF("𝔽⌾(a⊸⊏)𝕩: Result of 𝔽 must have the same shape as 'a' (expected %H, got %H)", w, rep);
|
||||
if (isAtm(rep) || !eqShape(w, rep)) thrF("𝔽⌾(a⊸⊏)𝕩: 𝔽 must return an array with the same shape as its input (expected %H, got %H)", w, rep);
|
||||
#if CHECK_VALID
|
||||
TALLOC(bool, set, xia);
|
||||
bool sparse = wia < xia/64;
|
||||
|
||||
@ -1313,7 +1313,7 @@ static B takedrop_ucw(i64 wi, B o, u64 am, B x, ux xr) {
|
||||
B rep = c1(o, taga(arg));
|
||||
if (isAtm(rep)) thrM("𝔽⌾(n⊸↑): 𝔽 returned an atom");
|
||||
usz* repsh = SH(rep);
|
||||
if (RNK(rep)==0 || !eqShPart(repsh+1, SH(x)+1, xr-1) || repsh[0]!=am) thrM("𝔽⌾(n⊸↑)𝕩: 𝔽 returned an array with a different shape than n↑𝕩");
|
||||
if (RNK(rep)==0 || !eqShPart(repsh+1, SH(x)+1, xr-1) || repsh[0]!=am) thrF("𝔽⌾(n⊸↑)𝕩: 𝔽 must return an array with the same shape as its input (%l ≡ n, %H ≡ shape of result of 𝔽)", wi, rep);
|
||||
|
||||
MAKE_MUT_INIT(r, xia, el_or(TI(x,elType), TI(rep,elType))); MUTG_INIT(r);
|
||||
if (wi<0) {
|
||||
@ -1334,7 +1334,7 @@ B take_ucw(B t, B o, B w, B x) {
|
||||
u64 am = wi<0? -wi : wi;
|
||||
if (isAtm(x)) x = m_vec1(x);
|
||||
ur xr = RNK(x); if (xr==0) xr = 1;
|
||||
if (am>SH(x)[0]) thrF("𝔽⌾(n⊸↑)𝕩: Cannot modify fill with Under (%l ≡ 𝕨, %H ≡ ≢𝕩)", wi, x);
|
||||
if (am>SH(x)[0]) thrF("𝔽⌾(n⊸↑)𝕩: Cannot modify fill with Under (%l ≡ n, %H ≡ ≢𝕩)", wi, x);
|
||||
return takedrop_ucw(wi, o, am, x, xr);
|
||||
}
|
||||
|
||||
@ -1350,7 +1350,7 @@ B drop_ucw(B t, B o, B w, B x) {
|
||||
}
|
||||
|
||||
static B shape_uc1_t(B r, usz ia) {
|
||||
if (!isArr(r) || RNK(r)!=1 || IA(r)!=ia) thrM("𝔽⌾⥊: 𝔽 changed the shape of the argument");
|
||||
if (!isArr(r) || RNK(r)!=1 || IA(r)!=ia) thrF("𝔽⌾⥊: 𝔽 must return an array with the same shape as its input (%s ≡ ≢⥊𝕩, %H ≡ shape of result of 𝔽)", ia, r);
|
||||
return r;
|
||||
}
|
||||
B shape_uc1(B t, B o, B x) {
|
||||
|
||||
@ -987,7 +987,7 @@ B slash_ucw(B t, B o, B w, B x) {
|
||||
B arg = C2(slash, incG(w), incG(x));
|
||||
usz argIA = IA(arg);
|
||||
B rep = c1(o, arg);
|
||||
if (isAtm(rep) || RNK(rep)!=1 || IA(rep) != argIA) thrF("𝔽⌾(a⊸/)𝕩: Result of 𝔽 must have the same shape as a/𝕩 (expected ⟨%s⟩, got %H)", argIA, rep);
|
||||
if (isAtm(rep) || RNK(rep)!=1 || IA(rep) != argIA) thrF("𝔽⌾(a⊸/)𝕩: 𝔽 must return an array with the same shape as its input (expected ⟨%s⟩, got %H)", argIA, rep);
|
||||
MAKE_MUT_INIT(r, ia, el_or(TI(x,elType), TI(rep,elType)));
|
||||
SGet(x)
|
||||
SGet(rep)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user