aboutsummaryrefslogtreecommitdiff
path: root/desiredata/src/builtins.c
diff options
context:
space:
mode:
authorN.N. <matju@users.sourceforge.net>2009-05-29 05:16:49 +0000
committerN.N. <matju@users.sourceforge.net>2009-05-29 05:16:49 +0000
commite6561e6f2276663caf1181a77c5dbe2fde9797e7 (patch)
treef2060828eb66f0879f2dc2f32e6b14ff06053223 /desiredata/src/builtins.c
parent56a4e7b17bac564b3fa923c192835fb6ebebcbcc (diff)
fix [atan2]
svn path=/trunk/; revision=11559
Diffstat (limited to 'desiredata/src/builtins.c')
-rw-r--r--desiredata/src/builtins.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/desiredata/src/builtins.c b/desiredata/src/builtins.c
index a036df65..b1547ab9 100644
--- a/desiredata/src/builtins.c
+++ b/desiredata/src/builtins.c
@@ -1172,29 +1172,13 @@ static int mydiv(int a, int b) {
}
BINOP(binop_mydiv, (float)mydiv((int)a,(int)b))
+BINOP(binop_atan2, (a==0 && b==0 ? 0 : atan2f(a,b)));
+
FUNC1(sin,sinf(a))
FUNC1(cos,cosf(a))
FUNC1(tan,tanf(a))
FUNC1(atan,atanf(a))
-static t_class *atan2_class;
-struct t_atan2 : t_object {
- float f;
-};
-static void *atan2_new() {
- t_atan2 *x = (t_atan2 *)pd_new(atan2_class);
- static int warned;
- if (!warned) post("warning: atan2 inlets switched from Pd 0.37 to 0.38"), warned=1;
- floatinlet_new(x, &x->f);
- x->f = 0;
- outlet_new(x, &s_float);
- return x;
-}
-static void atan2_float(t_atan2 *x, t_float f) {
- float r = (f == 0 && x->f == 0 ? 0 : atan2f(f, x->f));
- outlet_float(x->outlet, r);
-}
-
FUNC1(sqrt,sqrtf(a))
FUNC1(log, a>0 ? logf(a) : -1000)
FUNC1(exp,expf(min(a,87.3365f)))
@@ -1251,6 +1235,7 @@ void arithmetic_setup() {
BINOPDECL(binop_pc,"%")
BINOPDECL(binop_mymod,"mod")
BINOPDECL(binop_mydiv,"div")
+ BINOPDECL(binop_atan2,"atan2");
s = gensym("math");
@@ -1263,7 +1248,6 @@ void arithmetic_setup() {
FUNCDECL(cos,"cos");
FUNCDECL(tan,"tan");
FUNCDECL(atan,"atan");
- FUNCDECL(atan2,"atan2"); /* actually a binop */
FUNCDECL(sqrt,"sqrt");
FUNCDECL(log,"log");
FUNCDECL(exp,"exp");