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

Support for unsigned Fixed-point operations #33

Open
2 tasks
appetrosyan opened this issue Oct 12, 2022 · 1 comment
Open
2 tasks

Support for unsigned Fixed-point operations #33

appetrosyan opened this issue Oct 12, 2022 · 1 comment

Comments

@appetrosyan
Copy link

Sometimes it is obvious that a number cannot be negative (or zero). It is also true of fixed point numbers.

Given this, it would be nice if Fixed supported using the extra bit for the precision, e.g.

  • Fixed<u64> which itself starts from zero, and doesn't carry the sign bit. Internally promotes to u128 just like i64.
  • Fixed<NonZeroU64>. Same as before except it also has a niche.

The implementations for cadd, csub etc. need to be adjusted accordingly.

@loyd
Copy link
Owner

loyd commented Oct 20, 2022

I've thought about it, and it would be a nice feature, but I'm afraid to complicate things while all FixedPoint instances are generated by a macro. I want to reconsider this idea after moving to const generics.

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