-
Notifications
You must be signed in to change notification settings - Fork 23
Describe fixed-point types #26
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
Conversation
|
In the CI environment, clang-format-18 is used for formatting, but the After I applied +#define twin_int_div(a, b) (((uint16_t) (a) *255) / (b))
-#define twin_int_div(a, b) (((uint16_t) (a) * 255) / (b))but in CI environment, -#define twin_int_div(a, b) (((uint16_t) (a) *255) / (b))
+#define twin_int_div(a, b) (((uint16_t) (a) * 255) / (b)) |
Make sure clang-format-18 is properly installed. See https://apt.llvm.org/ |
jserv
left a comment
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.
Fix typo in the subject "Add descripition of fixed-point type"
jserv
left a comment
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.
Use git rebase rather than git merge.
In the original comment, the fixed-point type was only
explained using 12.4 and 24.8, lacking details about
the number of bits allocated for the integer, fractional,
and sign parts.
Here, following the supplementary content for C99 in
'section 6.3.6.3 fixed-point types' of the ISO/IEC TR 18037:2008,
additional descriptions of these fixed-point types are provided.
In particular:
In a fixed-point type where
N bits are used to represent the value, with
L bits allocated for the integer part, the remaining
N−L bits are used for the fractional part.
The actual value range of this fixed-point type is from -2^L to 2^{L}-2^{N-L}.
Additionally, a table is provided showing hexadecimal, decimal, binary,
and actual values to help developers quickly understand
the value range of this fixed-point type.
Refs:
1. ISO/IEC TR 18037:2008
4.2 Detailed changes to ISO/IEC 9899:1999
|
Do we need to consider compatibility with one's complement? |
No. |
|
Thank @jouae for contributing! |
Describing the type using only the 12.4, 24.8, or 2.6 format is unclear for reading and doesn't clearly indicate
how many bits are used for the integer and fractional parts.
Add a brief explanation to clarify the meaning of the numbers before and after the decimal point.
The number before the decimal point represents how many bits are used for the integer part, and the number after the decimal point represents how many bits are used for the fractional part.