summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 45b476d)
raw | patch | inline | side by side (parent: 45b476d)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 4 May 2004 21:01:29 +0000 (21:01 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 4 May 2004 21:01:29 +0000 (21:01 +0000) |
single direction for graphing. CDEF:avdir=yavg,xavg,/,ATAN,57.296,*,xavg,0,LT,180,0,IF,+,DUP,0,LT,360,0,IF,+
-- Daniel Shiels <dan@marge.tofubar.com>
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@247 a5681a0c-68f1-0310-ab6d-d61299d08faa
-- Daniel Shiels <dan@marge.tofubar.com>
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@247 a5681a0c-68f1-0310-ab6d-d61299d08faa
doc/rrdgraph_rpn.src | patch | blob | history | |
src/rrd_rpncalc.c | patch | blob | history | |
src/rrd_rpncalc.h | patch | blob | history |
diff --git a/doc/rrdgraph_rpn.src b/doc/rrdgraph_rpn.src
index f9ac7fedb9959cb66390026df5dd1fe921009c20..65f09177a9e005e8398790cc3acf7aa6822395c2 100644 (file)
--- a/doc/rrdgraph_rpn.src
+++ b/doc/rrdgraph_rpn.src
Sine, cosine (input in radians), log, exp (natural logarithm)
+B<ATAN>
+
+Arctangent. Output in radians.
+
B<FLOOR, CEIL>
Round down,up to the nearest integer
diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c
index 65748cc491cf1933ee48934aa2b7ebb9dc3463dc..52d7a11897f2153262ee6fde4ca13b7375616d7a 100644 (file)
--- a/src/rrd_rpncalc.c
+++ b/src/rrd_rpncalc.c
add_op(OP_NOW,NOW)
add_op(OP_LTIME,LTIME)
add_op(OP_TIME,TIME)
+ add_op(OP_ATAN,ATAN)
#undef add_op
}
match_op(OP_NOW,NOW)
match_op(OP_LTIME,LTIME)
match_op(OP_TIME,TIME)
+ match_op(OP_ATAN,ATAN)
#undef match_op
stackunderflow(0);
rpnstack -> s[stptr] = sin(rpnstack -> s[stptr]);
break;
+ case OP_ATAN:
+ stackunderflow(0);
+ rpnstack -> s[stptr] = atan(rpnstack -> s[stptr]);
+ break;
case OP_COS:
stackunderflow(0);
rpnstack -> s[stptr] = cos(rpnstack -> s[stptr]);
diff --git a/src/rrd_rpncalc.h b/src/rrd_rpncalc.h
index 2aa6dfbe97de9611e96bb155d3aabc6b6aa6a4ff..fe456f231ee1ecfdf3ff37b4fbb7b58772a2a39e 100644 (file)
--- a/src/rrd_rpncalc.h
+++ b/src/rrd_rpncalc.h
#ifndef _RRD_RPNCALC_H
#define _RRD_RPNCALC_H
-/* WARNING: if new operators are added, they MUST be added after OP_END.
+/* WARNING: if new operators are added, they MUST be added at the very end of the list.
* This is because COMPUTE (CDEF) DS store OP nodes by number (name is not
* an option due to limited par array size). OP nodes must have the same
* numeric values, otherwise the stored numbers will mean something different. */
OP_DIV,OP_SIN, OP_DUP, OP_EXC, OP_POP,
OP_COS,OP_LOG,OP_EXP,OP_LT,OP_LE,OP_GT,OP_GE,OP_EQ,OP_IF,
OP_MIN,OP_MAX,OP_LIMIT, OP_FLOOR, OP_CEIL,
- OP_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF,OP_PREV_OTHER,OP_COUNT};
+ OP_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF,OP_PREV_OTHER,OP_COUNT,OP_ATAN};
typedef struct rpnp_t {
enum op_en op;