Subject: Re: [netmod] canonical form of floats

From: Martin Bjorklund <[email-masked]>
Date: Mon, 05 Jan 2009 11:01:18 +0100 (CET)

Andy Bierman <[email-masked]> wrote:
> XPath parsers will not accept the "+/- exponent" part,
> and will (incorrectly) accept an AdditiveExpr [rule 25] instead.
> 
> Since that won't work, even though it exactly meets
> the real needs of the NETCONF community, setting
> the precision manually for the %f option seems
> the obvious next choice. The values to set manually
> are not so obvious.

So, to summarize... we'd like to be compatible with existing
technology.  At a first glance, XSD seems to be the obvious candidate,
but XSD defines the canonical form to be in a form that XPath does not
understand.  So if we use the XSD definition, XPath won't work.

So we need to come up with our own definition.

So, what value should we use for the precision in %f?  Is there a
theoretical maximum we could use?  Otherwise we'll have to pick a
"large" number.  Unfortunately, %f pads with trailing zeros, but OTOH,
since it's straightforward to remove these trailing zeros after the
call to snprintf, we could state that trailing zeros are removed in
the canonical form.

Also, if we use "%f" we might want to align our "[-]INF" and "NaN" to
"[-]inf" and "nan".

/martin
_______________________________________________
netmod mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/netmod

---

From: Martin Bjorklund <[email-masked]>
Date: Wed, 07 Jan 2009 22:05:33 +0100 (CET)

> call to snprintf, we could state that trailing zeros are removed in

An alternative to this is to state that the canonical form is e.g. the
format corresponding to %.17E (maybe with trailing zeros after the
point removed).  This ensures that the value is readable, but the
drawback is that XPath numerical comparisons cannot be used in XPath
filters.  Maybe that is ok?

/martin

---

From: "tom.petch" <[email-masked]>
Date: Fri, 9 Jan 2009 18:58:58 +0100

----- Original Message -----
From: "Martin Bjorklund" <[email-masked]>
To: <[email-masked]>
Cc: <[email-masked]>
Sent: Wednesday, January 07, 2009 10:05 PM
Subject: Re: [netmod] canonical form of floats

> filters.  Maybe that is ok?
I've got lost here.  The YANG data model allows floats, the server must output
them in canonical form but where does XPath come into it?  Is my get-config
going to return XPath expressions:-)?

If the gotten values are going to be sent back to the server as part of an XPath
expression, then yes, any float must be converted into fixed because that is
what XPath 1.0 requires, but the XPath specification allows the fixed
representation to encompass any float value so I have lost sight of the problem
in so far as XPath comes into it.

Tom Petch

---

From: "tom.petch" <[email-masked]>
Date: Thu, 15 Jan 2009 10:32:04 +0100

Reading yang-03, I think I now understand the problem.  7.5.3 (eg) says

" Note that since all leaf values in the data tree are conceptually
   stored in their canonical form (see Section 7.6 and Section 7.7), any
   XPath comparisons are done on the canonical value."

so a float will be in xEy format which XPath 1.0 does not allow.  But I think
that that is simply solved since XPath 1.0 does allow decimal representations
that encompass the range of a float so add a note to that effect, that the float
must be conceptually coerced into decimal representation before the XPath
comparison is performed.

Tom Petch

----- Original Message -----
From: "tom.petch" <[email-masked]>
To: "Andy Bierman" <[email-masked]>; "Martin Bjorklund"
<[email-masked]>
Cc: <[email-masked]>
Sent: Friday, January 09, 2009 6:58 PM
Subject: Re: [netmod] canonical form of floats