[rrd-developers] NAN-safe ADD
tstripf at gmx.de
Fri Mar 7 00:50:19 CET 2008
i'm running a distributed daemon over several servers. On every
server rrd files are recorded for usage stats and these files are
exported by NFS. On one control server all rrd files are combined
using the ADDNAN operator. If one server was not running the value
would be NaN and it should be treated as 0. If all values are NaN the
complete system was not running at this time and the result should be
NaN to be ignored by the TREND line or year average information.
is not the same since NaN + NaN would be 0.
An alternative for ADDNAN would be
and this is getting more complex if you like to add three or more
values this way. A NANTOZERO operator would not help here.
The ADDNAN operator is associative and commutative.
I also thought about adding NAN-safe versions of other arithmetic
functions. For subtraction NaN could also be treated as 0 but i found
no real scenario where this would be useful. For multiplication NaN
could be treated as the neutral element 1. Reasonable? ... i don't
know. Division and module are far more complex.
One could think about adding NAN-safe MAX/MIN functions. MAXNAN(a,
NaN) would be a and not NaN.
At 06:48 06.03.2008, you wrote:
> > On Thu, Mar 06, 2008 at 01:44:30AM +0100, Timo Stripf wrote:
> > > Hello,
> > >
> > > i've implemented a nan-safe add operator (ADDNAN) into rrd. I used it
> > > to add several incomplete graphs.
> > >
> > > NaN + NaN => NaN
> > > x + NaN => x
> > > NaN + y => y
> > > x + y => x + y
> > [...]
> > Quite often 'NaN' does not mean 'nothing'. In many cases substituting
> > the average of the two neighbours (not direct neighbours per se) would
> > make more sense.
> > At the very least I think this feature deserves more documentation than
> > just a line or two.
>How about doing this explicitly:
>then the effort for doing it has some relationship to the 'danger'
>of the operation.
>or if you insist to make this simpler, how about implementing a
>NANTOZERO operator ?
>Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten
>http://it.oetiker.ch tobi at oetiker.ch ++41 62 213 9902
>rrd-developers mailing list
>rrd-developers at lists.oetiker.ch
More information about the rrd-developers