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

Fix an age-old bug with FromFloat handling of negatives. #268

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

robshakir
Copy link
Contributor

 * (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 https://github.com/openconfig/ygot/issues/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.

 * (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.
@coveralls
Copy link

coveralls commented Jul 10, 2024

Coverage Status

coverage: 77.848% (+0.005%) from 77.843%
when pulling 69235d4 on fix-negatives
into dfbf7ba on master.

Copy link
Collaborator

@wenovus wenovus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find, thanks.

Interesting to know that Go also has undefined-ish behaviour for non-sensical code: https://go.dev/issue/52943

@robshakir robshakir merged commit 9eb4298 into master Jul 10, 2024
10 checks passed
@robshakir robshakir deleted the fix-negatives branch July 10, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants