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

round should not exist on floats #57

Open
Tehforsch opened this issue Jan 8, 2024 · 0 comments
Open

round should not exist on floats #57

Tehforsch opened this issue Jan 8, 2024 · 0 comments
Labels
enhancement New feature or request unit-safety Features relating to unit safety

Comments

@Tehforsch
Copy link
Owner

round is not a unit-safe method since it depends on the underlying base unit in the current implementation. I don't think it should exist on quantities right now.

Doing this properly would require either generating methods of the form round_in_<unit>, or could be done cleaner using the proposal in #56 by adding a round_in method which takes a unit ZST as an argument:

let length = Meters(1.95);
let feet = length.round_in(Feet);
let inches = (length - Feet(feet)).round_in(Inches);
@Tehforsch Tehforsch added enhancement New feature or request unit-safety Features relating to unit safety labels Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request unit-safety Features relating to unit safety
Projects
None yet
Development

No branches or pull requests

1 participant