•math function inverses
This commit is contained in:
parent
29bf1f1234
commit
77144cd79c
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#define FOR_PFN(A,M,D) \
|
||||
/* arith.c*/A(add,"+") A(sub,"-") A(mul,"×") A(div,"÷") A(pow,"⋆") A(root,"√") A(floor,"⌊") A(ceil,"⌈") A(stile,"|") A(eq,"=") \
|
||||
/* arith.c*/A(ne,"≠") D(le,"≤") D(ge,"≥") A(lt,"<") A(gt,">") A(and,"∧") A(or,"∨") A(not,"¬") A(log,"⋆⁼") \
|
||||
/* arith */A(add,"+") A(sub,"-") A(mul,"×") A(div,"÷") A(pow,"⋆") A(root,"√") A(floor,"⌊") A(ceil,"⌈") A(stile,"|") A(eq,"=") \
|
||||
/* arith */A(ne,"≠") D(le,"≤") D(ge,"≥") A(lt,"<") A(gt,">") A(and,"∧") A(or,"∨") A(not,"¬") A(log,"⋆⁼") \
|
||||
/* fns.c*/A(ud,"↕") A(fne,"≢") A(feq,"≡") A(ltack,"⊣") A(rtack,"⊢") A(indexOf,"⊐") A(memberOf,"∊") A(find,"⍷") A(count,"⊒") \
|
||||
/* sfns.c*/A(shape,"⥊") A(pick,"⊑") A(pair,"⋈") A(select,"⊏") A(slash,"/") A(join,"∾") A(couple,"≍") A(shiftb,"»") A(shifta,"«") A(take,"↑") A(drop,"↓") A(group,"⊔") A(reverse,"⌽") \
|
||||
/* sort.c*/A(gradeUp,"⍋") A(gradeDown,"⍒") \
|
||||
@ -13,7 +13,8 @@
|
||||
/* inverse.c*/M(setInvReg, "(SetInvReg)") M(setInvSwap, "(SetInvSwap)") M(nativeInvReg, "(NativeInvReg)") M(nativeInvSwap, "(NativeInvSwap)") \
|
||||
/*internal.c*/M(itype,"•internal.Type") M(elType,"•internal.ElType") M(refc,"•internal.Refc") M(isPure,"•internal.IsPure") A(info,"•internal.Info") \
|
||||
/*internal.c*/M(squeeze,"•internal.Squeeze") M(deepSqueeze,"•internal.DeepSqueeze") \
|
||||
/*internal.c*/D(variation,"•internal.Variation") A(listVariations,"•internal.ListVariations") M(clearRefs,"•internal.ClearRefs") M(unshare,"•internal.Unshare")
|
||||
/*internal.c*/D(variation,"•internal.Variation") A(listVariations,"•internal.ListVariations") M(clearRefs,"•internal.ClearRefs") M(unshare,"•internal.Unshare") \
|
||||
/* arithm.c*/M(sin,"•math.Sin") M(cos,"•math.Cos") M(tan,"•math.Tan") M(asin,"•math.Asin") M(acos,"•math.Acos") M(atan,"•math.Atan")
|
||||
|
||||
#define FOR_PM1(A,M,D) \
|
||||
/*md1.c*/A(tbl,"⌜") A(each,"¨") A(fold,"´") A(scan,"`") A(const,"˙") A(swap,"˜") A(cell,"˘") \
|
||||
|
||||
@ -71,9 +71,9 @@ B ne_c1(B t, B x) { B r = m_f64(isArr(x)&&rnk(x)? *a(x)->sh : 1); dec(x); return
|
||||
static B mathNS;
|
||||
B getMathNS() {
|
||||
if (mathNS.u == 0) {
|
||||
#define F(X,N) m_nfn(registerNFn(m_str32(U"•math." N), X##_c1, c2_bad),m_f64(0)),
|
||||
B fn = bqn_exec(m_str32(U"{⟨ Sin, Cos, Tan, Asin, Acos, Atan ⟩⇐𝕩}"), emptyCVec(), emptySVec());
|
||||
B arg = m_caB(6, (B[]){F(sin,U"Sin")F(cos,U"Cos")F(tan,U"Tan")F(asin,U"Asin")F(acos,U"Acos")F(atan,U"Atan")});
|
||||
#define F(X) inc(bi_##X),
|
||||
B fn = bqn_exec(m_str32(U"{⟨Sin, Cos, Tan, Asin, Acos, Atan ⟩⇐𝕩}"), emptyCVec(), emptySVec());
|
||||
B arg = m_caB(6, (B[]){F(sin)F(cos)F(tan)F(asin)F(acos)F(atan)});
|
||||
#undef F
|
||||
mathNS = c1(fn,arg);
|
||||
gc_add(mathNS);
|
||||
@ -89,4 +89,10 @@ void arith_init() {
|
||||
c(BFn,bi_ceil )->ident = m_f64(-1.0/0.0);
|
||||
|
||||
c(BFn,bi_sub)->im = sub_c1;
|
||||
c(BFn,bi_sin)->im = asin_c1;
|
||||
c(BFn,bi_cos)->im = acos_c1;
|
||||
c(BFn,bi_tan)->im = atan_c1;
|
||||
c(BFn,bi_asin)->im = sin_c1;
|
||||
c(BFn,bi_acos)->im = cos_c1;
|
||||
c(BFn,bi_atan)->im = tan_c1;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user