[rrd-developers] Unexpected behaviour of PREDICT and PREDICTSIGMA

Tobias Oetiker tobi at oetiker.ch
Fri Apr 25 08:42:13 CEST 2014


Hi Steve,

in the (contributed) code there is:

                // handle negative shifts special
                if (shifts<0) {
                    stptr--;
                } else {
                    stptr-=shifts;
                }

and later

                if (shifts<0) {
                    shiftstep = loop*rpnstack->s[stptr];
                } else {
                    shiftstep = rpnstack->s[stptr+loop];
                }


cheers
tobi

Wednesday Steve Shipway wrote:

> So, I'm delving into the PREDICT operations in the RPN, and have found
> something unexpected.
>
>
>
> There are two ways of specifying the shift offsets - as a (positive) count
> of shifts and a list; or as a negative count and a base shift.
>
>
>
> CDEF:predict1=172800,86400,0,3,3600,x,PREDICT
>
> CDEF:predict2=86400,-3,3600,x,PREDICT
>
>
>
> My tests (using 1.4.trunk) indicate that the two above have identical
> behaviour.  My question is, is this intended?  In particular, when giving a
> negative  shift count, should the resulting list of shifts be based at 0?
>
>
>
> Given this:
>
>
>
> CDEF:predict=s,-3,w,x,PREDICT
>
>
>
> I had expected to get shifts of s, 2s and 3s.  Instead I get 0, s and 2s.
> Is this intentional, or a feature?
>
>
>
> As a corollary, it means that these two lines are also equal for ANY value
> of s
>
>
>
> CDEF:predict1=s,-1,3600,x,PREDICT
>
> CDEF:predict2=x,3600,TRENDNAN
>
>
>
> Thanks,
>
>
>
> Steve
>
>
>
>
>
> Steve Shipway
>
> University of Auckland
>
> UNIX Systems Design Team Lead
>
> s.shipway at auckland.ac.nz
>
> +64 (9) 3737 599 ext 86487
>
>
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
www.oetiker.ch tobi at oetiker.ch +41 62 775 9902



More information about the rrd-developers mailing list