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

Base Library Adjustments for Latest Motoko RTS #589

Open
wants to merge 27 commits into
base: next-moc
Choose a base branch
from

Conversation

luc-blaeser
Copy link
Contributor

@luc-blaeser luc-blaeser commented Sep 19, 2023

Adjusting the base library for latest Motoko RTS changes:

Changes:
The original Musl float formatter has been replaced by the Rust implementation with some subtle format changes:

  • Numbers are displayed with the actually defined precision, no longer truncating trailing zeros and potentially revealing existing numeric errors.
  • The exponent is printed with an explicit sign and multiple digits.
  • NaN is formatted differently, now NaN, while the NaN sign bit is omitted.
  • The hexadecimal float formatter is no longer supported (Float.format(#hex)). This is probably acceptable as it is rarely used.

Once we have dfinity/motoko#4677 merged in Motoko master, then we can remove the backwards compatibility of float formatting in these tests. Backwards compatibility is here needed to make motoko-base tests pass with the old Motoko compiler version.

@luc-blaeser luc-blaeser changed the title Experimental: 64-Bit Support for Motoko Base Library Adjustments for 64-Bit Support in Motoko Dec 21, 2023
@luc-blaeser luc-blaeser changed the title Base Library Adjustments for 64-Bit Support in Motoko Base Library Adjustments for Latest Motoko RTS Aug 29, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@crusso crusso left a comment

Choose a reason for hiding this comment

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

FTR there's a crate that supports hex formatting https://crates.io/crates/hexfloat2, but perhaps we can't use it (or don't want to).

Copy link
Contributor

@crusso crusso left a comment

Choose a reason for hiding this comment

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

I wonder if this PR should actually go into branch next-moc, not master, since that is what we test against in the motoko repo.

After the merge, we'd have to adjust moc's nix/sources.json to reference the commit on next-moc.

When we make a release of base, the changes from next-moc will be merged into master.

Moc's ci actually tests against motoko-base/next-moc. I was confused why this works currently but I guess it's because, prior to this PR, the moc CI would only test the classical version of the compiler, whose behaviour is still unchanged until we dump musl, right?

@luc-blaeser
Copy link
Contributor Author

luc-blaeser commented Sep 11, 2024

FTR there's a crate that supports hex formatting https://crates.io/crates/hexfloat2, but perhaps we can't use it (or don't want to).

This looks interesting and also quite small. Certainly worth to try. Will put this on my backlog. Thank you for pointing to this library!

@luc-blaeser
Copy link
Contributor Author

luc-blaeser commented Sep 11, 2024

I wonder if this PR should actually go into branch next-moc, not master, since that is what we test against in the motoko repo.

After the merge, we'd have to adjust moc's nix/sources.json to reference the commit on next-moc.

When we make a release of base, the changes from next-moc will be merged into master.

Moc's ci actually tests against motoko-base/next-moc. I was confused why this works currently but I guess it's because, prior to this PR, the moc CI would only test the classical version of the compiler, whose behaviour is still unchanged until we dump musl, right?

Thanks for explaining. You are right. I rebased the PR on next-moc.
Btw: The CI indeed only runs against the old musl. This PR would permit both float output formats in the tests, with and without musl. As soon as we have fully removed musl from both classical persistence and EOP, we can switch back to one expected format.

@luc-blaeser luc-blaeser changed the base branch from master to next-moc September 11, 2024 08:38
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.

2 participants