Skip to content

Think about aligning dtoa with JS behavior (also toFixed?) #1163

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

Open
dcodeIO opened this issue Mar 13, 2020 · 1 comment
Open

Think about aligning dtoa with JS behavior (also toFixed?) #1163

dcodeIO opened this issue Mar 13, 2020 · 1 comment

Comments

@dcodeIO
Copy link
Member

dcodeIO commented Mar 13, 2020

While implementing WASI's trace I noticed that we currently don't have the utility in place to omit trailing decimal .0s when converting a float to a string, like JS would do. As a result, WASI's trace prints those decimal places, while JS's trace does not.

trace("hello world", 3, 1, 2, 3.5);
// trace: hello world 1.0 2.0 3.5

This looks like it is not quite the same but similar in nature to toFixed, and looking into both instead of implementing workarounds might be ideal.

@torch2424
Copy link
Contributor

Oops, I just ran into the missing .toFixed today 😂 No worries though! I don't actually "need" it. But I'm commenting here, so I can remember to open a PR for it if I get the time 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants