Subject: [Roll] Nit: C '/ ' and floor; 8bit and 256 value; rank computation example?

From: Alexandru Petrescu <[email-masked]>
Date: Sun, 25 Jul 2010 01:54:22 +0200

> The integer portion of the Rank is computed by the DAGRank() macro
> as follows, where floor(x) is the function that evaluates to the
> greatest integer less than or equal to x:
>
>
> DAGRank(rank) = floor(rank/MinHopRankIncrease)
>
>
> MinHopRankIncrease is provisioned at the DODAG Root and propagated in
> the DIO message.

What is '/' in rank/MinHopRankIncrease - is it integer division?
  Real (fixed or float)?

Were '/' the one in C then I suppose we wouldn't need floor(?)

If an example were written in the text then I'd be interested to read, 
to clarify, sorry if I misunderstand.

STill about this, earlier it says:
> DEFAULT_MIN_HOP_RANK_INCREASE  This is the default value of
> MinHopRankIncrease.  DEFAULT_MIN_HOP_RANK_INCREASE has a value of
> 256.  This configuration results in an 8-bit wide integer part of
> Rank.

So the Rank can't have an integer part '0'?

(besides I don't understand why we need only 8bits to represent a 
minimum value 256 when we don't know the max value of this integer part 
- do we?)

(also: if we needed only the values power of 2 between 1 and 256 then 
4bits would be sufficient, not 8)

(this is why I don't understand the logic here... examples helpful).

Alex

---

From: JP Vasseur <[email-masked]>
Date: Sun, 25 Jul 2010 10:47:09 +0200

On Jul 25, 2010, at 1:54 AM, Alexandru Petrescu wrote:

> If an example were written in the text then I'd be interested to  
> read, to clarify, sorry if I misunderstand.

Yes indeed we will add an example in the next revision. Here it is  
(hope that clarifies):

3.6.1.  Rank Comparison (DAGRank())

    Rank may be thought of as a fixed point number, where the position  
of
    the radix point between the integer part and the fractional part is
    determined by MinHopRankIncrease.  MinHopRankIncrease is the minimum
    increase in rank between a node and any of its DODAG parents.  A
    DODAG Root provisions MinHopRankIncrease.  MinHopRankIncrease  
creates
    a tradeoff between hop cost precision and the maximum number of hops
    a network can support.  A very large MinHopRankIncrease, for  
example,
    allows precise characterization of a given hop's affect on Rank but
    cannot support many hops.

    When an objective function computes rank, the objective function
    operates on the entire (i.e. 16-bit) rank quantity.  When rank is
    compared, e.g. for determination of parent relationships or loop
    detection, the integer portion of the rank is to be used.  The
    integer portion of the Rank is computed by the DAGRank() macro as
    follows, where floor(x) is the function that evaluates to the
    greatest integer less than or equal to x:

    For example, if a 16-bit rank quantity is decimal 27, and the
    MinHopRankIncrease is decimal 16, then DAGRank(27) = floor(1.6875) =
    1.  The integer part of the rank is 1 and the fractional part is
    11/16.

    By convention in this document, using the macro DAGRank(node) may be
    interpreted as DAGRank(node.rank), where node.rank is the rank value
    as maintained by the node.

    A node A has a rank less than the rank of a node B if DAGRank(A) is
    less than DAGRank(B).

    A node A has a rank equal to the rank of a node B if DAGRank(A) is
    equal to DAGRank(B).

    A node A has a rank greater than the rank of a node B if DAGRank(A)
    is greater than DAGRank(B).

> minimum value 256 when we don't know the max value of this integer  
> part - do we?)
>
> (also: if we needed only the values power of 2 between 1 and 256  
> then 4bits would be sufficient, not 8)
>
> _______________________________________________
> Roll mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/roll