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

Generic over f64/f32? #6

Open
bjadamson opened this issue Mar 8, 2021 · 2 comments
Open

Generic over f64/f32? #6

bjadamson opened this issue Mar 8, 2021 · 2 comments

Comments

@bjadamson
Copy link

bjadamson commented Mar 8, 2021

Hi there,

Thanks for making this crate! Would you be open to supporting f32's as well as just f64?

ie: https://docs.rs/coord_transforms/1.3.0/coord_transforms/d2/fn.cartesian2polar.html is hardcoded for f64.

Right now I'm doing a bunch of unnecessary casts because my engine uses f32's atm. I'm still learning rust, but if your knowledgeable about a good method for doing so (maybe something like rust's Into trait?) I would be happy to put together a PR, if your open to merging/discussing it.

Thanks!

@DaveKram
Copy link
Owner

Sorry, been working a lot so I don't usually have time to respond quickly to things anymore.

I thought of doing a more generic approach when I first started this a few years ago, but ended up not. There is the potential for using the num_traits crate, and using the Float trait to provide per function generic definitions for f32 and f64 since they both implement Float.

Thoughts?

@bjadamson
Copy link
Author

That seems very reasonable. I'll see when I can find some time to work on this. Thanks for letting me know your interested in merging changes.

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