•math.Atan2

This commit is contained in:
dzaima 2022-11-05 20:36:54 +02:00
parent 25694db7ca
commit 36111276c6
3 changed files with 10 additions and 3 deletions

View File

@ -17,7 +17,7 @@
/*internal.c*/M(itype,"•internal.Type") M(elType,"•internal.ElType") M(refc,"•internal.Refc") M(isPure,"•internal.IsPure") A(info,"•internal.Info") M(heapDump,"•internal.HeapDump") \
/*internal.c*/M(squeeze,"•internal.Squeeze") M(deepSqueeze,"•internal.DeepSqueeze") D(eequal,"•internal.EEqual") A(internalTemp,"•internal.Temp") \
/*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")
/* 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") D(atan2,"•math.Atan2")
#define FOR_PM1(A,M,D) \
/*md1.c*/A(tbl,"") A(each,"¨") A(fold,"´") A(scan,"`") A(const,"˙") A(swap,"˜") A(cell,"˘") A(insert,"˝") \

View File

@ -16,6 +16,7 @@ B mul_c2(B, B, B); B root_c2(B, B, B);
B and_c2(B, B, B); B stile_c2(B, B, B);
B or_c2 (B, B, B); B log_c2(B, B, B);
B floor_c2(B, B, B);
B atan2_c2(B, B, B);
typedef void (*AndBytesFn)(u8*, u8*, u64, u64);
@ -359,4 +360,10 @@ AR_F_SCALAR("|", stile, pfmod(x.f, w.f))
AR_F_SCALAR("⋆⁼",log , log(x.f)/log(w.f))
#undef AR_F_SCALAR
B atan2_c2(B t, B w, B x) {
if (isNum(w) && isNum(x)) return m_f64(atan2(x.f, w.f));
P2(atan2)
thrM("•math.Atan2: Unexpected argument types");
}
#undef P2

View File

@ -107,8 +107,8 @@ static B mathNS;
B getMathNS() {
if (mathNS.u == 0) {
#define F(X) inc(bi_##X),
Body* d = m_nnsDesc("sin","cos","tan","asin","acos","atan");
mathNS = m_nns(d, F(sin)F(cos)F(tan)F(asin)F(acos)F(atan));
Body* d = m_nnsDesc("sin","cos","tan","asin","acos","atan","atan2");
mathNS = m_nns(d, F(sin)F(cos)F(tan)F(asin)F(acos)F(atan)F(atan2));
#undef F
gc_add(mathNS);
}