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

Add integer-only versions of rounding functions #243

Open
chiphogg opened this issue Jun 11, 2024 · 0 comments
Open

Add integer-only versions of rounding functions #243

chiphogg opened this issue Jun 11, 2024 · 0 comments
Labels
⬇️ affects: code (interfaces) Affects the way end users will interact with the library 📁 kind: enhancement New feature or request 💪 effort: medium

Comments

@chiphogg
Copy link
Contributor

Right now, all of our rounding functions (the round, floor, and ceil families) are designed as "unit-aware" analogues of their standard library counterparts. This has the galling consequence that for people working with pure integer types, even though the final result will also be an integer, we need to take a detour through the floating point domain, because that is what the standard library functions do!

It feels like we could do way better, with an approach that Au makes possible which I've never seen before. We should be able to generate rounding functions that live purely inside of the integral domain. For example, we could generate a unit that is half the target unit, add "1" in this unit, and truncate the result. We'd need a bunch of test cases, but this could be really useful (especially for embedded code).

@chiphogg chiphogg added 📁 kind: enhancement New feature or request 💪 effort: medium ⬇️ affects: code (interfaces) Affects the way end users will interact with the library labels Jun 11, 2024
@chiphogg chiphogg added this to the 0.3.6 milestone Jul 24, 2024
@chiphogg chiphogg removed this from the 0.4.0 milestone Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⬇️ affects: code (interfaces) Affects the way end users will interact with the library 📁 kind: enhancement New feature or request 💪 effort: medium
Projects
None yet
Development

No branches or pull requests

1 participant