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

(stdlib) Use better format in float and double conversion to string #414

Conversation

perlun
Copy link
Collaborator

@perlun perlun commented Oct 30, 2023

The main benefit of this new format is that it's "more" predictable, and we can more easily mimic the exact byte-by-byte output in the C++ implementation.

The downside is that we may have problems with roundtripping to string and back with this format, because of precision loss. Let's live with this for now; it's (for now) more important that all integration tests pass in compiled and interpreted mode. .NET Framework seems to have been using G7 and G15 by default, so it can't be that bad. ;)

@perlun
Copy link
Collaborator Author

perlun commented Oct 30, 2023

I'm marking this a Draft for now; we want to ensure we can really produce the exact same format in #409 (on top of this MR) before we consider it worth merging.

release-notes/v0.4.0.md Outdated Show resolved Hide resolved
The main benefit of this new format is that it's "more" predictable, and
we can more easily mimic the exact byte-by-byte output in the C++ implementation.

The downside is that we *may* have problems with roundtripping to string
and back with this format, because of precision loss. Let's live with
this for now; it's (for now) more important that all integration tests
pass in compiled and interpreted mode. .NET Framework seems to have been
using G7 and G15 by default, so it can't be that bad. ;)
@perlun perlun force-pushed the fix/avoid-expontential-notation-for-certain-floating-point-numbers branch from 8b6f2ae to e04217e Compare November 1, 2023 20:53
@perlun perlun changed the title (stdlib) Use another format in float and double conversion to string (stdlib) Use better format in float and double conversion to string Nov 1, 2023
@perlun perlun marked this pull request as ready for review November 1, 2023 20:54
@perlun
Copy link
Collaborator Author

perlun commented Nov 1, 2023

I'm marking this a Draft for now; we want to ensure we can really produce the exact same format in #409 (on top of this MR) before we consider it worth merging.

This has now been verified. I'm scheduling this for merge in a moment. 🎉

@perlun perlun added enhancement New feature or request language Language features (or bugs) experimental compilation Issues which are relevant when using experimental compilation labels Nov 1, 2023
@perlun perlun added this to the 0.4.0 milestone Nov 1, 2023
@perlun perlun enabled auto-merge (squash) November 1, 2023 20:56
@perlun perlun merged commit fec87fb into master Nov 1, 2023
13 checks passed
@perlun perlun deleted the fix/avoid-expontential-notation-for-certain-floating-point-numbers branch November 1, 2023 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental compilation Issues which are relevant when using experimental compilation language Language features (or bugs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant