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

Replace From<u16> by From<u8> for conversions to degrees #3

Closed
yoanlcq opened this issue Jan 8, 2018 · 0 comments
Closed

Replace From<u16> by From<u8> for conversions to degrees #3

yoanlcq opened this issue Jan 8, 2018 · 0 comments

Comments

@yoanlcq
Copy link
Owner

yoanlcq commented Jan 8, 2018

The num-traits crate has an interesting way to convert radians to degrees. It boils down to this :

fn to_degrees(self) -> Self {
    self * Self::from(90u8) / (Self::PI / 2.)
}

So far my code has been doing Self::from(360) instead, hence the From<u16> bound.
But now that I've seen this, I would like to use From<u8> instead, which is less restrictive.

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

1 participant