Code

Imported upstream version 1.3.8.
[pkg-rrdtool.git] / doc / rrdgraph_rpn.txt
index d115537bdb9df0a1849f52bc6292dea62cc695e7..3c55e87a2a6e3228f7daa885a1964b8dd0d3d708 100644 (file)
@@ -9,19 +9,19 @@ S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
        _\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn:=_\bv_\bn_\ba_\bm_\be|_\bo_\bp_\be_\br_\ba_\bt_\bo_\br|_\bv_\ba_\bl_\bu_\be[,_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn]
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
-       If you have ever used a traditional HP calculator you already know R\bRP\bPN\bN.
-       The idea behind R\bRP\bPN\bN is that you have a stack and push your data onto
-       this stack. Whenever you execute an operation, it takes as many ele-
-       ments from the stack as needed. Pushing is done implicitly, so whenever
-       you specify a number or a variable, it gets pushed onto the stack auto-
-       matically.
+       If you have ever used a traditional HP calculator you already know R\bRP\bPN\bN
+       (Reverse Polish Notation).  The idea behind R\bRP\bPN\bN is that you have a
+       stack and push your data onto this stack. Whenever you execute an
+       operation, it takes as many elements from the stack as needed. Pushing
+       is done implicitly, so whenever you specify a number or a variable, it
+       gets pushed onto the stack automatically.
 
        At the end of the calculation there should be one and only one value
        left on the stack.  This is the outcome of the function and this is
-       what is put into the _\bv_\bn_\ba_\bm_\be.  For C\bCD\bDE\bEF\bF instructions, the stack is pro-
-       cessed for each data point on the graph. V\bVD\bDE\bEF\bF instructions work on an
-       entire data set in one run. Note, that currently V\bVD\bDE\bEF\bF instructions only
-       support a limited list of functions.
+       what is put into the _\bv_\bn_\ba_\bm_\be.  For C\bCD\bDE\bEF\bF instructions, the stack is
+       processed for each data point on the graph. V\bVD\bDE\bEF\bF instructions work on
+       an entire data set in one run. Note, that currently V\bVD\bDE\bEF\bF instructions
+       only support a limited list of functions.
 
        Example: "VDEF:maximum=mydata,MAXIMUM"
 
@@ -30,9 +30,9 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
 
        Example: "CDEF:mydatabits=mydata,8,*"
 
-       This means:  push variable _\bm_\by_\bd_\ba_\bt_\ba, push the number 8, execute the oper-
-       ator _\b*. The operator needs two elements and uses those to return one
-       value.  This value is then stored in _\bm_\by_\bd_\ba_\bt_\ba_\bb_\bi_\bt_\bs.  As you may have
+       This means:  push variable _\bm_\by_\bd_\ba_\bt_\ba, push the number 8, execute the
+       operator _\b*. The operator needs two elements and uses those to return
+       one value.  This value is then stored in _\bm_\by_\bd_\ba_\bt_\ba_\bb_\bi_\bt_\bs.  As you may have
        guessed, this instruction means nothing more than _\bm_\by_\bd_\ba_\bt_\ba_\bb_\bi_\bt_\bs _\b= _\bm_\by_\bd_\ba_\bt_\ba _\b*
        _\b8.  The real power of R\bRP\bPN\bN lies in the fact that it is always clear in
        which order to process the input.  For expressions like "a = b + 3 * 5"
@@ -44,15 +44,15 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
        Boolean operators
            L\bLT\bT,\b, L\bLE\bE,\b, G\bGT\bT,\b, G\bGE\bE,\b, E\bEQ\bQ,\b, N\bNE\bE
 
-           Pop two elements from the stack, compare them for the selected con-
-           dition and return 1 for true or 0 for false. Comparing an _\bu_\bn_\bk_\bn_\bo_\bw_\bn
-           or an _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\be value will always result in 0 (false).
+           Pop two elements from the stack, compare them for the selected
+           condition and return 1 for true or 0 for false. Comparing an
+           _\bu_\bn_\bk_\bn_\bo_\bw_\bor an _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\be value will always result in 0 (false).
 
            U\bUN\bN,\b, I\bIS\bSI\bIN\bNF\bF
 
-           Pop one element from the stack, compare this to _\bu_\bn_\bk_\bn_\bo_\bw_\bn respec-
-           tively to _\bp_\bo_\bs_\bi_\bt_\bi_\bv_\be _\bo_\br _\bn_\be_\bg_\ba_\bt_\bi_\bv_\be _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\by. Returns 1 for true or 0
-           for false.
+           Pop one element from the stack, compare this to _\bu_\bn_\bk_\bn_\bo_\bw_\bn
+           respectively to _\bp_\bo_\bs_\bi_\bt_\bi_\bv_\be _\bo_\br _\bn_\be_\bg_\ba_\bt_\bi_\bv_\be _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\by. Returns 1 for true
+           or 0 for false.
 
            I\bIF\bF
 
@@ -70,8 +70,8 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
 
            Pops two elements from the stack and returns the smaller or larger,
            respectively.  Note that _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\be is larger than anything else.  If
-           one of the input numbers is _\bu_\bn_\bk_\bn_\bo_\bw_\bn then the result of the opera-
-           tion will be _\bu_\bn_\bk_\bn_\bo_\bw_\bn too.
+           one of the input numbers is _\bu_\bn_\bk_\bn_\bo_\bw_\bn then the result of the
+           operation will be _\bu_\bn_\bk_\bn_\bo_\bw_\bn too.
 
            L\bLI\bIM\bMI\bIT\bT
 
@@ -94,10 +94,16 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
 
            Add, subtract, multiply, divide, modulo
 
+           A\bAD\bDD\bDN\bNA\bAN\bN
+
+           NAN-safe addition. If one parameter is NAN/UNKNOWN it'll be treated
+           as zero. If both parameters are NAN/UNKNOWN, NAN/UNKNOWN will be
+           returned.
+
            S\bSI\bIN\bN,\b, C\bCO\bOS\bS,\b, L\bLO\bOG\bG,\b, E\bEX\bXP\bP,\b, S\bSQ\bQR\bRT\bT
 
-           Sine and cosine (input in radians), log and exp (natural loga-
-           rithm), square root.
+           Sine and cosine (input in radians), log and exp (natural
+           logarithm), square root.
 
            A\bAT\bTA\bAN\bN
 
@@ -106,12 +112,13 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
            A\bAT\bTA\bAN\bN2\b2
 
            Arctangent of y,x components (output in radians).  This pops one
-           element from the stack, the x (cosine) component, and then a sec-
-           ond, which is the y (sine) component.  It then pushes the arctan-
-           gent of their ratio, resolving the ambiguity between quadrants.
+           element from the stack, the x (cosine) component, and then a
+           second, which is the y (sine) component.  It then pushes the
+           arctangent of their ratio, resolving the ambiguity between
+           quadrants.
 
-           Example: "CDEF:angle=Y,X,ATAN2,RAD2DEG" will convert "X,Y" compo-
-           nents into an angle in degrees.
+           Example: "CDEF:angle=Y,X,ATAN2,RAD2DEG" will convert "X,Y"
+           components into an angle in degrees.
 
            F\bFL\bLO\bOO\bOR\bR,\b, C\bCE\bEI\bIL\bL
 
@@ -143,7 +150,7 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
 
            Example: "CDEF:x=a,b,c,d,4,AVG"
 
-           T\bTR\bRE\bEN\bND\bD
+           T\bTR\bRE\bEN\bND\bD,\b, T\bTR\bRE\bEN\bND\bDN\bNA\bAN\bN
 
            Create a "sliding window" average of another data series.
 
@@ -161,10 +168,16 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
                                          delay      t2
                                     <--------------->
 
+
                 Value at sample (t0) will be the average between (t0-delay) and (t0)
                 Value at sample (t1) will be the average between (t1-delay) and (t1)
                 Value at sample (t2) will be the average between (t2-delay) and (t2)
 
+           TRENDNAN is - in contrast to TREND - NAN-safe. If you use TREND and
+           one source value is NAN the complete sliding window is affected.
+           The TRENDNAN operation ignores all NAN-values in a sliding window
+           and computes the average of the remaining values.
+
        Special values
            U\bUN\bNK\bKN\bN
 
@@ -180,8 +193,8 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
 
            Pushes an _\bu_\bn_\bk_\bn_\bo_\bw_\bn value if this is the first value of a data set or
            otherwise the result of this C\bCD\bDE\bEF\bF at the previous time step. This
-           allows you to do calculations across the data.  This function can-
-           not be used in V\bVD\bDE\bEF\bF instructions.
+           allows you to do calculations across the data.  This function
+           cannot be used in V\bVD\bDE\bEF\bF instructions.
 
            P\bPR\bRE\bEV\bV(\b(v\bvn\bna\bam\bme\be)\b)
 
@@ -199,7 +212,7 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
 
        Time
            Time inside RRDtool is measured in seconds since the epoch. The
-           epoch is defined to be "Thu Jan 1 00:00:00 UTC 1970".
+           epoch is defined to be "Thu Jan  1 00:00:00 UTC 1970".
 
            N\bNO\bOW\bW
 
@@ -213,9 +226,9 @@ O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
            L\bLT\bTI\bIM\bME\bE
 
            Takes the time as defined by T\bTI\bIM\bME\bE, applies the time zone offset
-           valid at that time including daylight saving time if your OS sup-
-           ports it, and pushes the result on the stack.  There is an elabo-
-           rate example in the examples section below on how to use this.
+           valid at that time including daylight saving time if your OS
+           supports it, and pushes the result on the stack.  There is an
+           elaborate example in the examples section below on how to use this.
 
        Processing the stack directly
            D\bDU\bUP\bP,\b, P\bPO\bOP\bP,\b, E\bEX\bXC\bC
@@ -235,6 +248,11 @@ V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS
 
            Example: "VDEF:avg=mydata,AVERAGE"
 
+       STDEV
+           Returns the standard deviation of the values.
+
+           Example: "VDEF:stdev=mydata,STDEV"
+
        LAST, FIRST
            Return the last/first value including its time.  The time for FIRST
            is actually the start of the corresponding interval, whereas LAST
@@ -270,8 +288,8 @@ V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS
            y-intercept _\b(_\bb_\b), which happens also to be the first data point on
            the graph. LSLCORREL is the Correlation Coefficient (also know as
            Pearson's Product Moment Correlation Coefficient).  It will range
-           from 0 to +/-1 and represents the quality of fit for the approxima-
-           tion.
+           from 0 to +/-1 and represents the quality of fit for the
+           approximation.
 
            Example: "VDEF:slope=mydata,LSLSLOPE"
 
@@ -286,8 +304,9 @@ S\bSE\bEE\bE A\bAL\bLS\bSO\bO
 A\bAU\bUT\bTH\bHO\bOR\bR
        Program by Tobias Oetiker <tobi@oetiker.ch>
 
-       This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
+       This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
+       corrections and/or additions by several people
 
 
 
-1.2.26                            2007-11-20                   RRDGRAPH_RPN(1)
+1.3.8                             2009-02-21                   RRDGRAPH_RPN(1)