Skip to content

support fesetround(FE_UPWARD)? #19908

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

Closed
Innovgame opened this issue Jul 27, 2023 · 4 comments
Closed

support fesetround(FE_UPWARD)? #19908

Innovgame opened this issue Jul 27, 2023 · 4 comments

Comments

@Innovgame
Copy link

Innovgame commented Jul 27, 2023

Please include the following in your bug report:

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.43 (a6b8143)
clang version 17.0.0 (https://github.com/llvm/llvm-project 71513a71cdf380efd6a44be6939e2cb979a62407)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: D:\emsdk\upstream\bin

Failing command line in full:
fesetround(FE_UPWARD) not work. My code relies on it, what should I do?

@renqh123
Copy link

I have also encountered this issue recently and I really hope to find an effective solution.

@sbc100
Copy link
Collaborator

sbc100 commented Jul 27, 2023

Can you give an example that fails? Does it fail to build or does it fail to produce the correct results?

@sbc100
Copy link
Collaborator

sbc100 commented Jul 27, 2023

IIUC this is a feature is missing from the underlying WebAssembly instruction set. IIUC we have no way to control the floating point unit in this way. @tlively can you confirm?

Update: It looks like there is an active proposal to add rounding mode control: https://github.com/WebAssembly/rounding-mode-control. The discussion that let to this proposal is WebAssembly/design#1456. However from the looks of the proposal it doesn't look like it would provide a way to implement fesetround which requires the ability to change the ambient rounding mode. Is my understanding correct @tlively ?

@tlively
Copy link
Member

tlively commented Jul 27, 2023

Yes, that is correct. While having an ambient rounding mode was considered, most folks want per-operation rounding mode instead because it is more in line with WebAssembly's design principles. The people in that discussion might be interested in hearing more about your use case, @renqh123. For the time being, you will have to change your code to not depend on an ambient rounding mode.

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

4 participants