1QN representation

Started by knight September 17, 2008
Hi

how can i represent any number in 32 bit signed 1QN format..
Let it be -1.5
knight  writes:

> Hi > > how can i represent any number in 32 bit signed 1QN format.. > Let it be -1.5
What is "1QN" format? -- % Randy Yates % "She has an IQ of 1001, she has a jumpsuit %% Fuquay-Varina, NC % on, and she's also a telephone." %%% 919-577-9882 % %%%% % 'Yours Truly, 2095', *Time*, ELO http://www.digitalsignallabs.com
On Sep 17, 10:40�am, Randy Yates  wrote:
> knight writes: > > Hi > > > how can i represent any number in 32 bit signed 1QN format.. > > Let it be -1.5 > > What is "1QN" format? > -- > % �Randy Yates � � � �
� � � � �% "She has an IQ of 1001, she has a jumpsuit
> %% Fuquay-Varina, NC � � � �
� �% � � � � � �on, and she's also a telephone."
> %%% 919-577-9882 � � � �
� � � �%
> %%%% � � � �
� % � � � �'Yours Truly, 2095', *Time*, ELO �http://www.digitalsignallabs.com Both, Google is your friend. Regards. Ken
Ken Asbury  writes:

> On Sep 17, 10:40�am, Randy Yates wrote: >> knight writes: >> > Hi >> >> > how can i represent any number in 32 bit signed 1QN format.. >> > Let it be -1.5 >> >> What is "1QN" format? >> -- >> % �Randy Yates � � �
� � � � � �% "She has an IQ of 1001, she has a jumpsuit
>> %% Fuquay-Varina, NC � � � �
� �% � � � � � �on, and she's also a telephone."
>> %%% 919-577-9882 � � � �
� � � �%
>> %%%% � � � �
� % � � � �'Yours Truly, 2095', *Time*, ELO �http://www.digitalsignallabs.com
> > Both, > > Google is your friend.
Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time sifting through the results looking for the gold specks in a bunch of dirt, and often they aren't there. -- % Randy Yates % "Remember the good old 1980's, when %% Fuquay-Varina, NC % things were so uncomplicated?" %%% 919-577-9882 % 'Ticket To The Moon' %%%% % *Time*, Electric Light Orchestra http://www.digitalsignallabs.com
On Sep 17, 11:11�am, Randy Yates  wrote:
> Ken Asbury writes: > > On Sep 17, 10:40�am, Randy Yates wrote: > >> knight writes: > >> > Hi > > >> > how can i represent any number in 32 bit signed 1QN format.. > >> > Let it be -1.5 > > >> What is "1QN" format? > >> -- > >> % �Randy Yates � � �
� � � � � �% "She has an IQ of 1001, she has a jumpsuit
> >> %% Fuquay-Varina, NC � � � �
� �% � � � � � �on, and she's also a telephone."
> >> %%% 919-577-9882 � � � �
� � � �%
> >> %%%% � � � �
� % � � � �'Yours Truly, 2095', *Time*, ELO �http://www.digitalsignallabs.com
> > > Both, > > > Google is your friend. > > Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time > sifting through the results looking for the gold specks in a bunch of > dirt, and often they aren't there. > -- > % �Randy Yates � � � �
� � � � �% "Remember the good old 1980's, when
> %% Fuquay-Varina, NC � � � �
� �% �things were so uncomplicated?"
> %%% 919-577-9882 � � � �
� � � �% 'Ticket To The Moon'
> %%%% � � � �
� % *Time*, Electric Light Orchestrahttp://www.digitalsignallabs.com- Hide quoted text -
> > - Show quoted text -
Randy, Geez, sorry to piss you off, man. To save your having to waste time sorting down to the 8th Google item, here's a link: http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/msg00938.html Knight, Until your time is as valuable as Randy's, Google is your friend. Regards, Ken
"Randy Yates"  wrote in message 
news:m34p4e6c3v.fsf@local.localhost...
> > Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time > sifting through the results looking for the gold specks in a bunch of > dirt, and often they aren't there. > --
Randy, If you're having trouble finding things with search engines, you could try Googling for "How to google". In this industry, if you can't work a search engine, you're in big trouble. If you can't be arsed to do that, here's a link. ;-) http://sudarmuthu.com/blog/2006/05/07/google-search-syntax-dissected.html HTH., Syms. p.s. To the OP, I replied on C.A.F.
Ken Asbury wrote:
> On Sep 17, 11:11 am, Randy Yates wrote: > >>Ken Asbury writes: >> >>>On Sep 17, 10:40 am, Randy Yates wrote: >>> >>>>knight writes: >>>> >>>>>Hi >> >>>>>how can i represent any number in 32 bit signed 1QN format.. >>>>>Let it be -1.5 >> >>>>What is "1QN" format? >>>>-- >>>>% Randy Yates % "She has an IQ of 1001, she has a jumpsuit >>>>%% Fuquay-Varina, NC % on, and she's also a telephone." >>>>%%% 919-577-9882 % >>>>%%%% % 'Yours Truly, 2095', *Time*, ELO
http://www.digitalsignallabs.com
>> >>>Both, >> >>>Google is your friend. >> >>Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time >>sifting through the results looking for the gold specks in a bunch of >>dirt, and often they aren't there. >>-- >>% Randy Yates % "Remember the good old 1980's, when >>%% Fuquay-Varina, NC % things were so uncomplicated?" >>%%% 919-577-9882 % 'Ticket To The Moon' >>%%%% % *Time*, Electric Light
Orchestrahttp://www.digitalsignallabs.com- Hide quoted text -
>> >>- Show quoted text - > > > Randy, > Geez, sorry to piss you off, man. > To save your having to waste time sorting down to the 8th Google item, > here's a link: > http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/msg00938.html > > > Knight, > Until your time is as valuable as Randy's, Google is your friend. > > Regards, > Ken
You're both right. Google *CAN* be useful. Google is often a *PAIN*!!!! And you can't be sure which it will be until _after_ the search. I've made a semi-hobby of outsmarting Google for the last 18 months. One thing I've learned is precede all search terms with "allintext:" . That limits hits to pages with search term in body of page. Otherwise some hits will be to pages which make a reference to pages which contain the search term. The art comes in choosing optimum boolean expression to get what you really want ;)
Ken Asbury  writes:

> On Sep 17, 11:11�am, Randy Yates wrote: >> Ken Asbury writes: >> > On Sep 17, 10:40�am, Randy Yates wrote: >> >> knight writes: >> >> > Hi >> >> >> > how can i represent any number in 32 bit signed 1QN format.. >> >> > Let it be -1.5 >> >> >> What is "1QN" format? >> >> -- >> >> % �Randy Yates � � �
� � � � � �% "She has an IQ of 1001, she has a jumpsuit
>> >> %% Fuquay-Varina, NC � � � �
� �% � � � � � �on, and she's also a telephone."
>> >> %%% 919-577-9882 � � � �
� � � �%
>> >> %%%% � � � �
� % � � � �'Yours Truly, 2095', *Time*, ELO �http://www.digitalsignallabs.com
>> >> > Both, >> >> > Google is your friend. >> >> Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time >> sifting through the results looking for the gold specks in a bunch of >> dirt, and often they aren't there. >> -- >> % �Randy Yates � � �
� � � � � �% "Remember the good old 1980's, when
>> %% Fuquay-Varina, NC � � � �
� �% �things were so uncomplicated?"
>> %%% 919-577-9882 � � � �
� � � �% 'Ticket To The Moon'
>> %%%% � � � �
� % *Time*, Electric Light Orchestrahttp://www.digitalsignallabs.com- Hide quoted text -
>> >> - Show quoted text - > > Randy, > Geez, sorry to piss you off, man. > To save your having to waste time sorting down to the 8th Google item, > here's a link: > > http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/msg00938.html
Well, thanks Ken. I'm not pissed off, just expressing an opinion.
> Knight, Until your time is as valuable as Randy's, Google is your > friend.
Perhaps we should all think like you, Ken? -- % Randy Yates % "And all that I can do %% Fuquay-Varina, NC % is say I'm sorry, %%% 919-577-9882 % that's the way it goes..." %%%% % Getting To The Point', *Balance of Power*, ELO http://www.digitalsignallabs.com
Ken Asbury   wrote:

>On Sep 17, 11:11�am, Randy Yates wrote:
>> Ken Asbury writes:
>>> Google is your friend.
>> Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time >> sifting through the results looking for the gold specks in a bunch of >> dirt, and often they aren't there.
>Geez, sorry to piss you off, man. >To save your having to waste time sorting down to the 8th Google item, >here's a link: >http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/msg00938.html
1QN seems to mean fractional two's complement in some proprietary context. The OP should use more standard terminology. Participants shouldn't have to google stuff like this up. Steve
On Sep 18, 1:00�am, spop...@speedymail.org (Steve Pope) wrote:
> Ken Asbury � wrote: > > >On Sep 17, 11:11�am, Randy Yates wrote: > >> Ken Asbury writes: > >>> Google is your friend. > >> Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time > >> sifting through the results looking for the gold specks in a bunch of > >> dirt, and often they aren't there. > >Geez, sorry to piss you off, man. > >To save your having to waste time sorting down to the 8th Google item, > >here's a link: > >http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/m... > > 1QN seems to mean fractional two's complement in some proprietary > context. > > The OP should use more standard terminology. �Participants shouldn't > have to google stuff like this up. > > Steve
I thought that was fairly standard terminology Q15 == no integer part and 15 bits of fraction Q31 == no integer part and 31 bits of fraction 1Q14 == 1 integer bit and 14 bits of fraction 1QN == 1 integer bit and all the remaining bits (however many they may be) are fraction All these kinda assume there is a sign bit as well. People don't often express unsigned fixed point in this way. I wonder what might be consider the appropriate shorthand way to say "no sign, no integer part and 16 bits of fraction"? Regards, Steve
>Hi > >how can i represent any number in 32 bit signed 1QN format.. >Let it be -1.5 >
Explanation of 1Qn representation at Freescale "MCF5271 Reference Manual" - chapter "4.5.2 Data Representation": Two’s complement, signed fractional: In an N-bit number, the first bit is the sign bit. The remaining bits signify the first N-1 bits after the binary point. Given an N-bit number, a[N-1]a[N-2]a[N-3]... a[2]a[1]a[0], its value is given by the equation in Figure 4-9. value = -(1*a[N-1])+Sum{2^(i+1_N)} where i=0 to N-2 Figure 4-9. Two’s Complement, Signed Fractional Equation. This format can represent numbers in the range -1 < operand < 1 - 2(N-1). For words and longwords, the largest negative number that can be represented is -1, whose internal representation is 0x8000 and 0x8000_0000, respectively. The largest positive word is 0x7FFF or (1 - 2-15); the most positive longword is 0x7FFF_FFFF or (1 - 2-31). To compute, you can use the following defines: typedef long FRAC32; // Duplicated in datastruct.h #define D_TO_F32(X) ((long)((X)*2147483648.0)) #define F32_TO_D(X) (((double)(X)) / 2147483648.0) See also related application notes and libraries at www.freescale.com
On Sep 17, 12:53 pm, Richard Owlett  wrote:
> Ken Asbury wrote: > > On Sep 17, 11:11 am, Randy Yates wrote: > > >>Ken Asbury writes: > > >>>On Sep 17, 10:40 am, Randy Yates wrote: > > >>>>knight writes: > > >>>>>Hi > > >>>>>how can i represent any number in 32 bit signed 1QN format.. > >>>>>Let it be -1.5 > > >>>>What is "1QN" format? > >>>>-- > >>>>% Randy Yates % "She has an IQ of 1001, she has a jumpsuit > >>>>%% Fuquay-Varina, NC % on, and she's also a telephone." > >>>>%%% 919-577-9882 % > >>>>%%%% % 'Yours Truly, 2095', *Time*, ELO
http://www.digitalsignallabs.com
> > >>>Both, > > >>>Google is your friend. > > >>Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time > >>sifting through the results looking for the gold specks in a bunch of > >>dirt, and often they aren't there. > >>-- > >>% Randy Yates % "Remember the good old 1980's, when > >>%% Fuquay-Varina, NC % things were so uncomplicated?" > >>%%% 919-577-9882 % 'Ticket To The Moon' > >>%%%% % *Time*, Electric Light
Orchestrahttp://www.digitalsignallabs.com-Hide quoted text -
> > >>- Show quoted text - > > > Randy, > > Geez, sorry to piss you off, man. > > To save your having to waste time sorting down to the 8th Google item, > > here's a link: > >http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/m... > > > Knight, > > Until your time is as valuable as Randy's, Google is your friend. > > > Regards, > > Ken > > You're both right. > Google *CAN* be useful. > Google is often a *PAIN*!!!! > And you can't be sure which it will be until _after_ the search.
i usually find Google to be useful and can usually find the necessary page after a couple of hits. Google is also pretty good at correcting my spelling errors (and reading my mind). one recent exception is this SF hotel i wanted to stay at where i was 2 years ago for the AES convention in '06 (it was a good tradeoff of cost, location, and decency). i could only remember "Milthia Hotel" and got *no* hits. finally gave up, went to hotels.com and did a general search and saw the name: Mithila. even though i could group "Milthia" with SF and even "Sutter St", it had no idea what i was typing about. that was one spelling error it did not correct. just 1 misplaced "l".
> I've made a semi-hobby of outsmarting Google for the last 18 months. > One thing I've learned is precede all search terms with "allintext:" . > That limits hits to pages with search term in body of page. Otherwise > some hits will be to pages which make a reference to pages which contain > the search term. The art comes in choosing optimum boolean expression to > get what you really want ;)
i don't even know about those options. i never knew of the "allintext:" specification. r b-j
Steve Pope wrote:
(snip)
> I myself have never seen this "1QN" family of notations > before. Of course there are many standards I have never > seen.
The PL/I form is the total bits (not including sign) and fraction bits, in the form FIXED BINARY(31,16) the scale factor (fraction bits) can be negative or greater than the total bits. -- glen
Darol Klawetter   wrote:

>The "Q" format is also used in the datasheets of Xilinx FPGA fixed- >point logic cores.
A link posted earlier suggested that is where the Q terminlogy arose. Steve
On Sep 17, 8:30 pm, spop...@speedymail.org (Steve Pope) wrote:
> wrote: > >On Sep 18, 1:00 am, spop...@speedymail.org (Steve Pope) wrote: > >> 1QN seems to mean fractional two's complement in some proprietary > >> context. > >> The OP should use more standard terminology. Participants shouldn't > >> have to google stuff like this up. > >I thought that was fairly standard terminology > > >Q15 == no integer part and 15 bits of fraction > >Q31 == no integer part and 31 bits of fraction > >1Q14 == 1 integer bit and 14 bits of fraction > >1QN == 1 integer bit and all the remaining bits (however many they may > >be) are fraction > >All these kinda assume there is a sign bit as well. People don't often > >express unsigned fixed point in this way. I wonder what might be > >consider the appropriate shorthand way to say "no sign, no integer > >part and 16 bits of fraction"? > > I personally might call this a "fractional unsigned number". > > I myself have never seen this "1QN" family of notations > before. Of course there are many standards I have never > seen. Among unambiguous standards, I like System C fixed-point > types. Failing that plain English works ("X is a 20-bit 2's > complement value with three bits to the left of the binary point"). > > Steve
The "Q" format is also used in the datasheets of Xilinx FPGA fixed- point logic cores.
On Sep 17, 9:30�pm, spop...@speedymail.org (Steve Pope) wrote:
> wrote: > >On Sep 18, 1:00�am, spop...@speedymail.org (Steve Pope) wrote: > >> 1QN seems to mean fractional two's complement in some proprietary > >> context. > >> The OP should use more standard terminology. �Participants
shouldn't
> >> have to google stuff like this up. > >I thought that was fairly standard terminology > > >Q15 == no integer part and 15 bits of fraction > >Q31 == no integer part and 31 bits of fraction > >1Q14 == 1 integer bit and 14 bits of fraction > >1QN == 1 integer bit and all the remaining bits (however many they may > >be) are fraction > >All these kinda assume there is a sign bit as well. People don't often > >express unsigned fixed point in this way. I wonder what might be > >consider the appropriate shorthand way to say "no sign, no integer > >part and 16 bits of fraction"? > > I personally might call this a "fractional unsigned number". > > I myself have never seen this "1QN" family of notations > before. �Of course there are many standards I have never > seen. �Among unambiguous standards, I like System C fixed-point > types. �Failing that plain English works ("X is a 20-bit 2's > complement value with three bits to the left of the binary point"). > > Steve- Hide quoted text - > > - Show quoted text -
The form was commonly used in fractional machines (no overflow on division) in the days before they invented dirt (but not before Knuth) for doing orbital math and suchlike in assembly language. Fractional machines considered the leftmost (sign) bit as B0. Regards, Ken
 wrote:

>On Sep 18, 1:00�am, spop...@speedymail.org (Steve Pope) wrote:
>> 1QN seems to mean fractional two's complement in some proprietary >> context.
>> The OP should use more standard terminology. �Participants shouldn't >> have to google stuff like this up.
>I thought that was fairly standard terminology > >Q15 == no integer part and 15 bits of fraction >Q31 == no integer part and 31 bits of fraction >1Q14 == 1 integer bit and 14 bits of fraction >1QN == 1 integer bit and all the remaining bits (however many they may >be) are fraction
>All these kinda assume there is a sign bit as well. People don't often >express unsigned fixed point in this way. I wonder what might be >consider the appropriate shorthand way to say "no sign, no integer >part and 16 bits of fraction"?
I personally might call this a "fractional unsigned number". I myself have never seen this "1QN" family of notations before. Of course there are many standards I have never seen. Among unambiguous standards, I like System C fixed-point types. Failing that plain English works ("X is a 20-bit 2's complement value with three bits to the left of the binary point"). Steve
On Sep 18, 1:00�am, spop...@speedymail.org (Steve Pope) wrote:
> Ken Asbury � wrote: > > >On Sep 17, 11:11�am, Randy Yates wrote: > >> Ken Asbury writes: > >>> Google is your friend. > >> Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time > >> sifting through the results looking for the gold specks in a bunch of > >> dirt, and often they aren't there. > >Geez, sorry to piss you off, man. > >To save your having to waste time sorting down to the 8th Google item, > >here's a link: > >http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/m... > > 1QN seems to mean fractional two's complement in some proprietary > context. > > The OP should use more standard terminology. �Participants shouldn't > have to google stuff like this up. > > Steve
I thought that was fairly standard terminology Q15 == no integer part and 15 bits of fraction Q31 == no integer part and 31 bits of fraction 1Q14 == 1 integer bit and 14 bits of fraction 1QN == 1 integer bit and all the remaining bits (however many they may be) are fraction All these kinda assume there is a sign bit as well. People don't often express unsigned fixed point in this way. I wonder what might be consider the appropriate shorthand way to say "no sign, no integer part and 16 bits of fraction"? Regards, Steve
Ken Asbury   wrote:

>On Sep 17, 11:11�am, Randy Yates wrote:
>> Ken Asbury writes:
>>> Google is your friend.
>> Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time >> sifting through the results looking for the gold specks in a bunch of >> dirt, and often they aren't there.
>Geez, sorry to piss you off, man. >To save your having to waste time sorting down to the 8th Google item, >here's a link: >http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/msg00938.html
1QN seems to mean fractional two's complement in some proprietary context. The OP should use more standard terminology. Participants shouldn't have to google stuff like this up. Steve
Ken Asbury wrote:
> On Sep 17, 11:11 am, Randy Yates wrote: > >>Ken Asbury writes: >> >>>On Sep 17, 10:40 am, Randy Yates wrote: >>> >>>>knight writes: >>>> >>>>>Hi >> >>>>>how can i represent any number in 32 bit signed 1QN format.. >>>>>Let it be -1.5 >> >>>>What is "1QN" format? >>>>-- >>>>% Randy Yates % "She has an IQ of 1001, she has a jumpsuit >>>>%% Fuquay-Varina, NC % on, and she's also a telephone." >>>>%%% 919-577-9882 % >>>>%%%% % 'Yours Truly, 2095', *Time*, ELO
http://www.digitalsignallabs.com
>> >>>Both, >> >>>Google is your friend. >> >>Bullshit. Half the time I google, I spend a SIGNIFICANT amount of time >>sifting through the results looking for the gold specks in a bunch of >>dirt, and often they aren't there. >>-- >>% Randy Yates % "Remember the good old 1980's, when >>%% Fuquay-Varina, NC % things were so uncomplicated?" >>%%% 919-577-9882 % 'Ticket To The Moon' >>%%%% % *Time*, Electric Light
Orchestrahttp://www.digitalsignallabs.com- Hide quoted text -
>> >>- Show quoted text - > > > Randy, > Geez, sorry to piss you off, man. > To save your having to waste time sorting down to the 8th Google item, > here's a link: > http://newsgroups.derkeiler.com/Archive/Comp/comp.arch.fpga/2006-02/msg00938.html > > > Knight, > Until your time is as valuable as Randy's, Google is your friend. > > Regards, > Ken
You're both right. Google *CAN* be useful. Google is often a *PAIN*!!!! And you can't be sure which it will be until _after_ the search. I've made a semi-hobby of outsmarting Google for the last 18 months. One thing I've learned is precede all search terms with "allintext:" . That limits hits to pages with search term in body of page. Otherwise some hits will be to pages which make a reference to pages which contain the search term. The art comes in choosing optimum boolean expression to get what you really want ;)