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

Consider providing templates implementing other ways of expressing fixed points #90

Open
Pharap opened this issue Mar 26, 2021 · 0 comments
Assignees
Labels
Feature Request This issue is a request for a particular feature Minor This change is a minor addition

Comments

@Pharap
Copy link
Owner

Pharap commented Mar 26, 2021

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 with UFixed
  • Fixed<1, integer, fraction> is implemented with SFixed
  • All other representations are undefined

Other notations include:

  • s:m:f format, as described above as Fixed<sign, integer, fraction>
  • fx format where fx1.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 that UFixed and SFixed 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.

@Pharap Pharap added Feature Request This issue is a request for a particular feature Minor This change is a minor addition labels Mar 26, 2021
@Pharap Pharap self-assigned this Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request This issue is a request for a particular feature Minor This change is a minor addition
Projects
None yet
Development

No branches or pull requests

1 participant