| Electronics Forum |
Help
Search
Members
Calendar
|
| Welcome Guest ( Log In | Register ) | Resend Validation Email |
![]() ![]() ![]() |
| Shocker |
Posted: January 22, 2013 09:18 pm
|
![]() Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 1,484 Member No.: 3,558 Joined: November 06, 2005 |
Hi,
I want to find the range of a fixed point number, both signed and unsigned. So say i have a fixed point number of Q16.16. Using 2^15, i get the range to be -32768 to 32767 regardless of whether it's signed or not, is this correct? I assume that the max positive number is one smaller than the negative because it includes zero. |
| Colt45 |
Posted: January 22, 2013 09:31 pm
|
![]() Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 3,747 Member No.: 1,333 Joined: October 02, 2004 |
If it's unsigned, it would be 0-65535, no..?
Why would zero count as positive? -------------------- >]:::|-
|
| Sch3mat1c |
Posted: January 22, 2013 11:14 pm
|
![]() Forum Addict ++ Group: Moderators Posts: 18,144 Member No.: 73 Joined: July 24, 2002 |
Zero counts as positive signed (2's-complement) because bit 15 is zero.
Unsigned you get [0, 2^16 - 1], signed you get [-2^(16 - 1), 2^(16 - 1) - 1]. Also, the range of the fraction is 0 to 65535/65536ths (of course, with the same sign as the leading WORD). Tim -------------------- Answering questions is a tricky subject to practice. Not due to the difficulty of formulating or locating answers, but due to the human inability of asking the right questions; a skill that, were one to possess, would put them in the "answering" category.
|
| Shocker |
Posted: January 23, 2013 12:10 am
|
![]() Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 1,484 Member No.: 3,558 Joined: November 06, 2005 |
Ah yes. That is exactly what i was thinking Sch3mat1c, for some reason my fingers didn't do the talking they should have done. Although i do like the mini-formula's, as i wasn't thinking that logical.
So could one say that the total range, by combining the integer and fractional parts are...? Signed = -32767.0, 32767.99998 Unsigned = 0, 65535.99998 |
| Sch3mat1c |
Posted: January 23, 2013 04:21 am
|
![]() Forum Addict ++ Group: Moderators Posts: 18,144 Member No.: 73 Joined: July 24, 2002 |
Correction, the fraction should always be unsigned.
Consider: 0 (0000 0000) -- zero is always zero -0.00001... = -1 + 65535/65536ths (FFFF FFFF) (one bit less than zero) . . . -1.00000 (+ 0/65536ths) (FFFF 0000) -1.00001 = -2 + 65535/65536ths (FFFE FFFF) ... ... ... -32767.99998... = -32767 + 65535/65536ths (8000 FFFF) ... -32768.00000 (+ 0/65536ths) (8000 0000) (most negative number) -------------------- Answering questions is a tricky subject to practice. Not due to the difficulty of formulating or locating answers, but due to the human inability of asking the right questions; a skill that, were one to possess, would put them in the "answering" category.
|
| Shocker |
Posted: January 23, 2013 12:11 pm
|
||
![]() Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 1,484 Member No.: 3,558 Joined: November 06, 2005 |
This is also what i was meant to put in, so it was suppose to be.... Signed = -32768.0, 32767.99998 Unsigned = 0, 65535.99998 |
||
![]() |
![]() ![]() ![]() |
:: support us ::