Consider providing templates implementing other ways of expressing fixed points #90
Labels
Feature Request
This issue is a request for a particular feature
Minor
This change is a minor addition
There are times where it may be useful to be able to represent fixed points using notation other than the conventional Q format.
For example, it may be useful to have a type expressed as
Fixed<sign, integer, fraction>
, where:Fixed<0, integer, fraction>
is implemented withUFixed
Fixed<1, integer, fraction>
is implemented withSFixed
Other notations include:
s:m:f
format, as described above asFixed<sign, integer, fraction>
fx
format wherefx1.16
describes a 16-bit value with 1 integer but and 15 fractional bits.This isn't a particularly important feature, but there are cases where it might be useful.
There's the possibility of implementing it through template 'trickery' and type aliases or inheritance, but there's also the possibility (should the
Fixed
approach turn out to be more convinient) of inversing things such thatUFixed
andSFixed
become inheritors of the true implementation with minimal changes to the API such that it could still be compatible for more abstract use cases.Such an eventuality is probably still a long way down the road and may not be worthwhile, but it's at least worth pondering for the time being.
The text was updated successfully, but these errors were encountered: