-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fixed Point Value system #99
Conversation
For breadcrumbs, this is related: intel/rohd#470 |
@mkorbel1 , I will refactor this implementation based on your great comments:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes looking good!
@mkorbel1 , this PR is ready for final review. I will add randomized testing for operators. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of the two remaining comments?
- accessors for the fraction and integer portions
- to/from
FloatingPointValue
I don't think they are strictly necessary to add (or if we want them, necessarily in this PR), just closing out remaining comments.
Accessors for the fraction and integer portions: This is a bit tricky and needs to be defined clearly. Here is an example: Q0.4 does not have an integer part, yet it can represent -1. When one asks for integer portion, what should it return? to/from |
Ah good point, ok then!
What about large fixed point and floating point values that don't fit in double? |
Let's revisit from/to floating point after the refactoring is completed. Resolved all other comments in the last commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Description & Motivation
Introduce a value system to represent unsigned or signed fixed-point values following Q notation.
Related Issue(s)
Fixed point support
Testing
All constructors, methods and operators have unit tests.
Backwards-compatibility
Not a braking change.
Documentation
Added a dedicated page to document fixed-point arithmetic.