summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d9b29e2)
raw | patch | inline | side by side (parent: d9b29e2)
author | alex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 10 Mar 2002 14:48:59 +0000 (14:48 +0000) | ||
committer | alex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 10 Mar 2002 14:48:59 +0000 (14:48 +0000) |
program/src/rrd_rpncalc.c | patch | blob | history | |
program/src/rrd_rpncalc.h | patch | blob | history |
index 7a7a1242f9ede657e63133643f9e00873319f00a..818ef562e32c5820ba119e46474e3a2a1207ec91 100644 (file)
add_op(OP_UNKN,UNKN)
add_op(OP_UN,UN)
add_op(OP_NEGINF,NEGINF)
+ add_op(OP_NE,NE)
add_op(OP_PREV,PREV)
add_op(OP_INF,INF)
+ add_op(OP_ISINF,ISINF)
add_op(OP_NOW,NOW)
add_op(OP_LTIME,LTIME)
add_op(OP_TIME,TIME)
match_op(OP_UNKN,UNKN)
match_op(OP_UN,UN)
match_op(OP_NEGINF,NEGINF)
+ match_op(OP_NE,NE)
match_op(OP_PREV,PREV)
match_op(OP_INF,INF)
+ match_op(OP_ISINF,ISINF)
match_op(OP_NOW,NOW)
match_op(OP_LTIME,LTIME)
match_op(OP_TIME,TIME)
rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] >= rpnstack -> s[stptr] ? 1.0 : 0.0;
stptr--;
break;
+ case OP_NE:
+ if(stptr<1){
+ rrd_set_error("RPN stack underflow");
+ return -1;
+ }
+ if (isnan(rpnstack -> s[stptr-1]))
+ ;
+ else if (isnan(rpnstack -> s[stptr]))
+ rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
+ else
+ rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] == rpnstack -> s[stptr] ? 0.0 : 1.0;
+ stptr--;
+ break;
case OP_EQ:
if(stptr<1){
rrd_set_error("RPN stack underflow");
}
rpnstack->s[stptr] = isnan(rpnstack->s[stptr]) ? 1.0 : 0.0;
break;
+ case OP_ISINF:
+ if(stptr<0){
+ rrd_set_error("RPN stack underflow");
+ return -1;
+ }
+ rpnstack->s[stptr] = isinf(rpnstack->s[stptr]) ? 1.0 : 0.0;
+ break;
case OP_END:
- break;
+ break;
}
}
if(stptr!=0){
index 8fce2e91881bfb136fb06546c6370d14c7c8799d..4796695c20c6cdb90be6367511a5415ef7bf609a 100644 (file)
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_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF};
typedef struct rpnp_t {
enum op_en op;