Subject: [netmod] Question on YANG 'fraction-digit' statement

From: "Ivory, William" <[email-masked]>
Date: Thu, 19 Dec 2019 09:27:11 +0000

Hi,

I've got a question about the 'fraction-digit' statement which I'm hoping someone can clarify. I know it is used to specify the range of valid values, as shown (in part) in the table below:

     +----------------+-----------------------+----------------------+
     | fraction-digit | min                   | max                  |
     +----------------+-----------------------+----------------------+
     | 1              | -922337203685477580.8 | 922337203685477580.7 |
     | 2              | -92233720368547758.08 | 92233720368547758.07 |
     | 3              | -9223372036854775.808 | 9223372036854775.807 |

My question is whether it implicitly imposes any restriction on the number of digits that can follow the decimal point for a valid value, ie for 'fraction-digits 2', is 123.45678 valid, or only 123.45?

Thanks,

William

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 19 Dec 2019 12:20:22 +0100 (CET)

Hi,

"Ivory, William" <[email-masked]> wrote:
> Hi,
> 
> I've got a question about the 'fraction-digit' statement which I'm
> hoping someone can clarify. I know it is used to specify the range of
> valid values, as shown (in part) in the table below:
> 
> 
> My question is whether it implicitly imposes any restriction on the
> number of digits that can follow the decimal point for a valid value,
> ie for 'fraction-digits 2', is 123.45678 valid, or only 123.45?

If fraction-digits is 2, it means, according to section 9.3 in RFC
7950, that the value space consists of the real numbers that are
expressible as "i x 10^-2", where "i" is a 64-bit integer.  123.45678
cannot be expressed in this way, which means that it is not a valid
value for this type.

/martin

---

From: "Ivory, William" <[email-masked]>
Date: Thu, 19 Dec 2019 11:28:07 +0000

Hi Martin,

Thanks - yes, that makes sense.

William

On Thu, 2019-12-19 at 12:20 +0100, Martin Bjorklund wrote:

Hi,

"Ivory, William" <[email-masked]<mailto:[email-masked]>> wrote:

Hi,

value for this type.

/martin