[rrd-users] Re: Color working hours, RPN expr.
Alex van den Bogaerdt
alex at ergens.op.het.net
Tue Feb 3 13:15:24 MET 2004
On Tue, Feb 03, 2004 at 01:47:09PM +0200, mrugan wrote:
> i've tried this going step by step in the rpn and seemed that i didn't
> understood corectly the use of DUP.
> "DUP will duplicate the top of the stack, pushing the result back onto
> the stack" ...
> so "1,2,3,DUP" will duplicate 1 as 1x2 resulting 2 so the stack will look like 2,3,2
> (pushing back into the next free place that is the third place ?)
> or duplicating meaning the stack is going to look like 1,2,3,1
1,2,3,DUP will duplicate the nearest value.
1,2,3,DUP -> 1,2,3,3
> Anyways "in,POP,1,2,3,DUP" hangs on rpn error "RPN final stack size != 1"
Sure. Because the resulting stack is 1,2,3,3 which is not one value.
> so please... anyone rrd-rpn-guruz can "translate" to traditional notation the expression:
> while explaining the use of DUP and % (modulo operation) ?
You can do so yourself. Use some pieces of paper if you must. Stack them, and
do exactly as the manual tells you RRDtool would handle it.
If "DUP" duplicates the top, make a copy (a duplicate) of the visible piece of
paper and put it on the stack.
EXC takes two pieces of paper, and puts them back in the reverse order.
% (modulo) is just like a clock. At 11 hours, move forward 2 hours, you are
at 1 hours, not at 13 hours. This is modulo 12. It is also like a single
digit counter; its value is 9, add two, 9->0->1 so its new value is 1. This
is a modulo 10 counter.
Modulo in rrdtool takes two values from the stack and pushes the result back:
take two values from the stack: stack = a,b,c,d, hold in hand e,f
do modulo operation on e with base f
push result back on stack: stack = a,b,c,d,result
This message was produced without any <iframe tags
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
More information about the rrd-users