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

rand_distr: no_std support #922

Closed
dhardy opened this issue Dec 30, 2019 · 3 comments · Fixed by #987
Closed

rand_distr: no_std support #922

dhardy opened this issue Dec 30, 2019 · 3 comments · Fixed by #987
Labels
E-question Participation: opinions wanted

Comments

@dhardy
Copy link
Member

dhardy commented Dec 30, 2019

As @burdges and @kennytm recently pointed out, rand_distr currently depends on std for various mathematical functions (trig, exp).

Status: std provides these functions over the platform's native libm lib.

Available alternative: libm is a pure-Rust port of MUSL's libm. We could target this, perhaps behind a feature flag. I'm not sure whether we want to go this route.

See also: Portability of floats. Would use of the pure-Rust libm implementation address this?

@dhardy dhardy added E-question Participation: opinions wanted T-distributions labels Dec 30, 2019
@vks
Copy link
Collaborator

vks commented Dec 30, 2019

Maybe we should just use num_traits::float::Float, which gives us no_std support using libm for free.

@dhardy
Copy link
Member Author

dhardy commented Dec 30, 2019

My POV is that whatever we do, we make an explicit choice and not just use something, since this affects reproducibility (admittedly, only in cases where reproducibility is already hard to assure).

API cost is not really an issue here anyway (producing our own wrapper would be easy).

@burdges
Copy link
Contributor

burdges commented Dec 30, 2019

I think this sounds cool. Ain't clear if anyone needs this anytime soon, but I suppose exp comes up lots.

I agree that floats portability sounds like a bigger deal, but no idea if/where that should be addressed.

It plausible that many folks who want this actually want discrete distributions anyways, like negative binomial, etc., so maybe doing those clean first makes the most sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-question Participation: opinions wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants