-
Notifications
You must be signed in to change notification settings - Fork 107
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
decimal_type_test.go: Floating points failed on aarch64-darwin #766
Comments
Interesting, we haven't tested ygot on ARM machines. Go is supposed to have good support for ARM so I'm not sure what's happening here. I would be willing to review an update to our GitHub actions workflow that adds validation on the ARM architecture. |
Do you have some pointers on running GH Actions on ARM architecture? Came across a discussion using QEMU with cross-compilation here https://github.com/orgs/community/discussions/25319 I would be interested in learning more about Go ecosystem, specifically with cross-compiling. |
I see an action that some people are using, I think it might be the same QEMU emulation you're talking about: |
I think this is darwin, right? I wonder whether we can use the w.r.t the initial question -- these failures will mean that |
Oh, aologies -- these are not actually available it looks like. Sorry for the noise. |
According to the YANG 6020 Spec decimal64 values are defined as fixed point decimal numbers.
I understand the obvious value of storing values as native Go types. However, perhaps in light of this issue, and the problems of lost resolution in floating point numbers, it would be best to model decimal64 as a fixed point number, and do all validation with fixed point number operations. I have observed issues in existing Yang models with values being incorrectly rejected due to floating-point conversions pushing the value outside of the defined ranges for the leaf. Users may expect a level of precision that floating point numbers cannot provide. OpenConfig/goyang defines the yang.Number type in I would like to work on this. Are there any other considerations I should be aware of before I spend time implementing such a change and opening a PR? |
In practice, we have found that fixed-precision numbers are generally not what is required for the data that we are actually modelling. This approach (use of The change you propose will be majorly backwards incompatible for users, such that if it is pursued, it needs to be done behind a specific flag that cannot be the default to accommodate existing users of ygot for whom this functionality has not been a problem. [0]: in OpenConfig models, we defined an |
I understand, thank you for sharing that context. It sounds like implementing a flag for using a fixed-point model might not be worth the extra code-complexity & maintenance it brings. I will work on this for my own purposes, and will open a PR only if there is a nice clean way to do it without impacting the codebase too much. Edit: Apologies for going off-topic, this implementation would not fix the original issue discussed here. |
* (M) pkg/yang/types_builtin(_test)?.go - This change squashes a bug that has existed for a long time in `FromFloat`, but only shows up on arm64. I finally have an arm64 machine and so found the issue. It was originally reported in openconfig/ygot#766. The issue is that uint64 of a negative float64 is undefined -- and on arm64 on darwin returns 0, which made some test cases fail only on this architecture.
* Fix an age-old bug with `FromFloat` handling of negatives. * (M) pkg/yang/types_builtin(_test)?.go - This change squashes a bug that has existed for a long time in `FromFloat`, but only shows up on arm64. I finally have an arm64 machine and so found the issue. It was originally reported in openconfig/ygot#766. The issue is that uint64 of a negative float64 is undefined -- and on arm64 on darwin returns 0, which made some test cases fail only on this architecture. * Add missing comment. * `gofmt`
How fatal are these errors to
ygot
subcomponents?The text was updated successfully, but these errors were encountered: