Powered by Invision Power Board


Forum Rules Forum Rules (Please read before posting)
  Reply to this topicStart new topicStart Poll

> Finding The Range Of A Fixed Point Number
Shocker
Posted: January 22, 2013 09:18 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 1,634
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.
PMEmail Poster
Top
Colt45
Posted: January 22, 2013 09:31 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 4,399
Member No.: 1,333
Joined: October 02, 2004




If it's unsigned, it would be 0-65535, no..?

Why would zero count as positive?


--------------------
>]:::|-
PMEmail PosterICQ
Top
Sch3mat1c
Posted: January 22, 2013 11:14 pm
Reply to this postQuote Post


Forum Addict ++
Group Icon

Group: Moderators
Posts: 20,521
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.
PMEmail PosterUsers Website
Top
Shocker
Posted: January 23, 2013 12:10 am
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 1,634
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
PMEmail Poster
Top
Sch3mat1c
Posted: January 23, 2013 04:21 am
Reply to this postQuote Post


Forum Addict ++
Group Icon

Group: Moderators
Posts: 20,521
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.
PMEmail PosterUsers Website
Top
Shocker
Posted: January 23, 2013 12:11 pm
Reply to this postQuote Post


Forum Addict ++
*******

Group: Trusted Members
Posts: 1,634
Member No.: 3,558
Joined: November 06, 2005




QUOTE (Sch3mat1c @ January 23, 2013 04:21 am)
-32768.00000 (+ 0/65536ths) (8000 0000) (most negative number)

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
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 


:: support us ::




ElectronicsSkin by DutchDork & The-Force