-
Notifications
You must be signed in to change notification settings - Fork 391
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
Test and document floating point determinsm #312
Comments
I Did some research, and Go is using the IEEE 754 standard for floats: Also, I tried with different CPU architectures and go versions checking the binary representation, which was always the same. Protobuf, and by extension amino, are encoding floats using little-endian. |
To provide some context on this issue, see this article. We solve a lot of headaches by not allowing float multiply-accumulate within Gno already. That seems to be a great cause of pain in floating point determinism, particularly because x86 seems to have 80-bit precision1 for intermediate results. In order to make this issue actionable, I propose the following tasks:
Footnotes |
So, working on #1153, go 1.21 modifies this function and adds this interesting comment:
I'm slowly starting to think that if we want to have floating points in Gno, they should have a software implementation which uses no hardware floating points under the hood... |
We should bring over this file, and test/document any differences from x86 results: https://go.dev/src/runtime/softfloat64.go . Update: #2863 |
Closes: #312 The idea to use softfloat and work originates from this PR: #2863 <!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details> --------- Co-authored-by: Morgan Bazalgette <[email protected]> Co-authored-by: Miloš Živković <[email protected]>
#306 introduced floating point and decimals, but it isn't clear if it actually is deterministic across go versions and architectures. This Issue should remain open until genesis, to ensure that the genesis validators can stay in sync.
The text was updated successfully, but these errors were encountered: