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

Make functions in this crate const? #310

Closed
JSorngard opened this issue Oct 18, 2024 · 4 comments
Closed

Make functions in this crate const? #310

JSorngard opened this issue Oct 18, 2024 · 4 comments

Comments

@JSorngard
Copy link
Contributor

JSorngard commented Oct 18, 2024

Now that const_float_arithmetic has been stabilized, will the functions in this crate be made const where possible? Or is this not in scope due to MSRV policy?

@tgross35
Copy link
Contributor

The stabilization definitely would make it possible for some of these functions to work in const contexts. However, I don't think that is an API guarantee we want to make because it would be a pretty significant limit on flexibility (anything that uses SIMD, assembly, or generic algorithms would no longer usable).

I think the better solution is to just move the math functions from std to core, and then make those const using the host machine's implementation. This is already planned but we do need to improve some things in this crate before it is possible (e.g. fix rounding errors, make sure our implementation is performant enough to ship).

@tgross35
Copy link
Contributor

I am going to close this since I don't think we will make any changes in this crate's public API. I brought the topic of const float math up on Zulip since I don't think it has been discussed too much before https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/Const.20float.20math (feel free to drop by there if you have any interest working on it)

@tgross35 tgross35 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2024
@JSorngard
Copy link
Contributor Author

Makes sense. I might drop by there later to help work on this, could be fun!

@burrbull
Copy link
Contributor

I'd wait for 1.83 (beta now): rust-lang/rust#129195

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

3 participants