Re: NAN-safe ADD
Timo Stripf <tstripf <at> gmx.de>
2008-03-06 23:50:19 GMT
Hi Tobi,
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.
x=a,UN,0,a,IF,b,UN,0,b,IF,+
is not the same since NaN + NaN would be 0.
An alternative for ADDNAN would be
x=a,UN,b,b,UN,a,a,b,+,IF,IF
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,
(Continue reading)