Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xpath_tree2cbuf() changes integers into floating point representations #99

Closed
dcornejo opened this issue Nov 22, 2019 · 1 comment
Closed
Labels

Comments

@dcornejo
Copy link
Contributor

The function xpath_tree2cbuf() will always express numbers as a floating point type even if it is specified as an integer in the YANG model. A number in an xpath is received as "0" and is converted to "0.000000". Even though they represent the same number, the forms can imply different types in parsing the numbers in some software.

My desired solution is that the number in the output should have exactly the same form as the input. But is it possible also to just document that numbers in xpaths will always be floating point form.

I think that there is also a problem here in the YANG decimal64 type where the number of fractionals digits are specified - my interpretation of this is that a decimal64 should always be expressed with exactly the correct number of fractional digits, so if a decimal64 type has 2 fractional digits specified, like 1.00, then 1.0, 1.000, etc. are invalid forms even if they have the same floating point value. When the parsed number is converted back to a string type, the printf format "%lf" is used. On my system this produces 6 fractional digits, which is also a problem if the decimal64 has more than 6.

@olofhagsand
Copy link
Member

I have unit tested this, but not properly system tested. Can you please verify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants