Open appetrosyan opened 2 years ago
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
Fixed<u64>
u128
i64
Fixed<NonZeroU64>
The implementations for cadd, csub etc. need to be adjusted accordingly.
cadd
csub
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.
FixedPoint
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 tou128
just likei64
.Fixed<NonZeroU64>
. Same as before except it also has a niche.The implementations for
cadd
,csub
etc. need to be adjusted accordingly.