-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix misleading statement regarding sign bit #260
base: master
Are you sure you want to change the base?
Conversation
The original formulation of the README made me think that the bit pattern of `Fixed{IntN,f}` numbers is `[sign bit] [Int(N-1) number]`. I hope this alternative formulation makes it clearer that `Fixed{T,f}` numbers are based on 2's complement just like the underlying integer type `T`.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #260 +/- ##
=======================================
Coverage 93.08% 93.08%
=======================================
Files 6 6
Lines 767 767
=======================================
Hits 714 714
Misses 53 53 ☔ View full report in Codecov by Sentry. |
I know this is a matter of taste, but I think the changed description focuses too much on the internal implementation. Perhaps what we need is more graphical documentation (with Documenter.jl). |
The main problem I see with the current description is that to me, "1 sign bit, |
I believe I understand your thinking, and I think the specific example work well enough to eliminate such ambiguity. -1.0 = -128/128 ≤ x ≤ 127/128 ≈ 0.992. As far as the section is concerned, it is reasonable not to refer to the msb as "sign bit". I simply wanted to maintain this PR since it has been left open. So, I will leave this open. |
The "1 sign bit" also mislead me. It does not need to get as technical as proposed here, but I think the current wording is plain wrong.
What helped me, was this example
returning |
The original formulation of the README made me think that the bit pattern of
Fixed{IntN,f}
numbers is[sign bit] [Int(N-1) number]
. I hope this alternative formulation makes it clearer thatFixed{T,f}
numbers are based on 2's complement just like the underlying integer typeT
.