[Gridflow-cvs] [svn] commit: r6388 - in /trunk/src: expr.cxx numop1.cxx numop2.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Sat Oct 2 15:14:37 EDT 2010


Author: matju
Date: Sat Oct  2 15:14:37 2010
New Revision: 6388

Log:
add more unary and binary ops

Modified:
    trunk/src/expr.cxx
    trunk/src/numop1.cxx
    trunk/src/numop2.cxx

Modified: trunk/src/expr.cxx
==============================================================================
--- trunk/src/expr.cxx (original)
+++ trunk/src/expr.cxx Sat Oct  2 15:14:37 2010
@@ -233,7 +233,9 @@
 void startup_classes4 () {
 	#define PR1(SYM) priorities[t_atom2(A_OP1,gensym(#SYM))]
 	#define PR(SYM)  priorities[t_atom2(A_OP ,gensym(#SYM))]
-	PR1(sin) = PR1(cos) = PR1(exp) = PR1(log) = PR1(tanh) = PR1(sqrt) = PR1(abs) = PR1(rand) = 2;
+	PR1(sin) = PR1(cos) = PR1(tan) = PR1(sinh) = PR1(cosh) = PR1(tanh) = 2;
+	PR1(exp) = PR1(log) = PR1(curt) = PR1(sqrt) = PR1(abs) = PR1(rand) = PR1(expm1) = PR1(log1p) = 2;
+	PR1(isinf) = PR1(finite) = PR1(isnan) = 2;
 	PR(min) = PR(max) = PR(div) = PR(rem) = PR(cmp) = PR(hypot) = PR(atan2) = PR(avg) = 2;
 	PR1(+) = PR1(unary-) = PR1(~) = PR1(!) = 3;
 	PR(*) = PR(/) = PR(%) = 5;

Modified: trunk/src/numop1.cxx
==============================================================================
--- trunk/src/numop1.cxx (original)
+++ trunk/src/numop1.cxx Sat Oct  2 15:14:37 2010
@@ -74,51 +74,56 @@
 DEF_OPF(sqrt,floor(sqrt(a)),sqrt(a))
 DEF_OP(rand, a==0 ? (T)0 : (T)(random()%(int32)a))
 
-DEF_OP(sin,  sin(a))
-DEF_OP(cos,  cos(a))
+DEF_OP(sin,  sin(a))		DEF_OP(cx_sin,  sin(a))
+DEF_OP(cos,  cos(a))		DEF_OP(cx_cos,  cos(a))
 DEF_OP(tan,  tan(a))
 DEF_OP(asin, asin(a))
 DEF_OP(acos, acos(a))
 DEF_OP(atan, atan(a))
 DEF_OP(sinh, sinh(a))
 DEF_OP(cosh, cosh(a))
-DEF_OP(tanh, tanh(a))
+DEF_OP(tanh, tanh(a))		DEF_OP(cx_tanh, tanh(a))
 DEF_OP(asinh, asinh(a))
 DEF_OP(acosh, acosh(a))
 DEF_OP(atanh, atanh(a))
-DEF_OP(exp,  exp(a))
-DEF_OP(log,  log(a))
+DEF_OP(exp,  exp(a))		DEF_OP(cx_exp,  exp(a))
+DEF_OP(log,  log(a))		DEF_OP(cx_log,  log(a))
 
-DEF_OP(cx_sin,  sin(a))
-DEF_OP(cx_cos,  cos(a))
-DEF_OP(cx_tanh, tanh(a))
-DEF_OP(cx_exp,  exp(a))
-DEF_OP(cx_log,  log(a))
+DEF_OP(erf,  erf(a))
+DEF_OP(erfc, erfc(a))
+DEF_OP(cbrt, cbrt(a))
+DEF_OP(expm1, expm1(a))
+DEF_OP(log1p, log1p(a))
+DEF_OP(floor, floor(a))
+DEF_OP(ceil,  ceil(a))
 
 Numop1 op_table_unary[] = {
 	DECL_OP(unary_minus, "unary-"),
 	DECL_OP(logic_not, "!"),
 	DECL_OP(not, "~"),
 	DECL_OP(abs, "abs"),
-	DECL_OP(tan, "tan"),
-	DECL_OP(sinh, "sinh"),
-	DECL_OP(cosh, "cosh"),
 	//DECL_OP(asin, "asin"),
 	//DECL_OP(acos, "acos"),
 	//DECL_OP(atan, "atan"), // but atan is already reserved by a c° function.
 
 	DECL_OP(sqrt, "sqrt"),
 	DECL_OP(rand, "rand"),
-	DECL_OP_FLOAT(sin,  "sin"),
-	DECL_OP_FLOAT(cos,  "cos"),
-	DECL_OP_FLOAT(tanh, "tanh"),
-	DECL_OP_FLOAT(exp,  "exp"),
-	DECL_OP_FLOAT(log,  "log"),
-	DECL_VOP_FLOAT(cx_sin,  "C.sin",  2),
-	DECL_VOP_FLOAT(cx_cos,  "C.cos",  2),
-	DECL_VOP_FLOAT(cx_tanh, "C.tanh", 2),
-	DECL_VOP_FLOAT(cx_exp,  "C.exp",  2),
-	DECL_VOP_FLOAT(cx_log,  "C.log",  2),
+	DECL_OP_FLOAT(sin,  "sin"),   DECL_VOP_FLOAT(cx_sin,  "C.sin",  2),
+	DECL_OP_FLOAT(cos,  "cos"),   DECL_VOP_FLOAT(cx_cos,  "C.cos",  2),
+	DECL_OP_FLOAT(tan, "tan"),
+	DECL_OP_FLOAT(sinh, "sinh"),
+	DECL_OP_FLOAT(cosh, "cosh"),
+	DECL_OP_FLOAT(tanh, "tanh"),  DECL_VOP_FLOAT(cx_tanh, "C.tanh", 2),
+	DECL_OP_FLOAT(exp,  "exp"),   DECL_VOP_FLOAT(cx_exp,  "C.exp",  2),
+	DECL_OP_FLOAT(log,  "log"),   DECL_VOP_FLOAT(cx_log,  "C.log",  2),
+	DECL_OP_FLOAT(erf,  "erf"),
+	DECL_OP_FLOAT(erfc, "erfc"),
+	DECL_OP_FLOAT(cbrt, "cbrt"),
+	DECL_OP_FLOAT(expm1, "expm1"),
+	DECL_OP_FLOAT(log1p, "log1p"),
+	
+	DECL_OP_FLOAT(floor, "floor"),
+	DECL_OP_FLOAT(ceil, "ceil"),
 };
 const long op_table_unary_n = COUNT(op_table_unary);
 

Modified: trunk/src/numop2.cxx
==============================================================================
--- trunk/src/numop2.cxx (original)
+++ trunk/src/numop2.cxx Sat Oct  2 15:14:37 2010
@@ -237,6 +237,8 @@
 DEF_OP(ror,((uint64)a>>b)|((uint64)a<<(T)((-b)&(BITS(T)-1))),0,false,false)
 
 DEF_OP(atan2,atan2(a,b), 0, false, false)
+// 9.12
+DEF_OP(ldexp,ldexp(a,b), 0, false, false)
 #endif
 #ifdef PASS4
 
@@ -345,8 +347,6 @@
 	DECL_OP_NOFOLD(tanhmul,"tanh*", 0),
 	DECL_OP_NOFOLD(gamma,  "gamma", 0),
 	DECL_OP_NOFOLD(pow,    "**", 0),
-	DECL_OP_NOFOLD(logmul, "log*", 0),
-	DECL_OP_NOFOLD(divexp, "/exp", 0),
 // 0.8
 	DECL_OP(clipadd,"clip+", OP_ASSOC|OP_COMM),
 	DECL_OP(clipsub,"clip-", 0),
@@ -358,9 +358,11 @@
 	DECL_OP_NOFOLD_NOFLOAT(weight,"weight",OP_COMM),
 	DECL_OP_NOFOLD_NOFLOAT(rol,"rol",0),
 	DECL_OP_NOFOLD_NOFLOAT(ror,"ror",0),
-
 	DECL_OP_NOFOLD_FLOAT(atan2,"atan2", 0),
-
+// 9.12
+	DECL_OP_NOFOLD(logmul, "log*", 0),
+	DECL_OP_NOFOLD(divexp, "/exp", 0),
+	DECL_OP_NOFOLD(ldexp,  "ldexp", 0),
 };
 const long op_table3_n = COUNT(op_table3);
 #endif



More information about the Gridflow-cvs mailing list