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

FE_DOWNWARD, FE_UPWARD and FE_TOWARDZERO are not defined #85

Closed
saghul opened this issue Jul 12, 2019 · 4 comments
Closed

FE_DOWNWARD, FE_UPWARD and FE_TOWARDZERO are not defined #85

saghul opened this issue Jul 12, 2019 · 4 comments

Comments

@saghul
Copy link

saghul commented Jul 12, 2019

Hey there! I'm having quite some fun with WASI, kudos for the nice work!

Today while porting a library (QuickJS specifically) I ran into this. As the title says, those are not defined in wasi-sdk/share/sysroot/include/bits/fenv.h. I manually defined them and compilation continued though :-)

@sunfishcode
Copy link
Member

sunfishcode commented Jul 12, 2019

Thanks! WebAssembly itself only supports round-to-nearest. It doesn't support any other rounding modes. To reflect this, WASI libc only defines FE_TONEAREST, and not FE_DOWNWARD, FE_UPWARD and FE_TOWARDZERO.

You're welcome to manually define them, although note that this won't enable the platform to respect these rounding modes, so you may see floating-point results with incorrect rounding.

@saghul
Copy link
Author

saghul commented Jul 12, 2019

Ah, this is good to know! Do you see the other modes ever making it to the spec?

@sunfishcode
Copy link
Member

It's possible. There are some ideas about how this might work sketched out here, though at this time there isn't yet an active proposal for them, so it's difficult to say when this might advance.

@saghul
Copy link
Author

saghul commented Jul 13, 2019

Thanks for the insight! Feel free to close this if appropriate. Cheers!

saghul added a commit to saghul/wasi-lab that referenced this issue Jul 15, 2019
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

No branches or pull requests

2 participants