>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
Reply by robert bristow-johnson●September 19, 20082008-09-19
On Sep 17, 12:53 pm, Richard Owlett <rowl...@atlascomm.net> wrote:
> Ken Asbury wrote:
> > On Sep 17, 11:11 am, Randy Yates <ya...@ieee.org> wrote:
>
> >>Ken Asbury <avoidingspam2...@yahoo.com> writes:
>
> >>>On Sep 17, 10:40 am, Randy Yates <ya...@ieee.org> wrote:
>
> >>>>knight <krshe...@gmail.com> 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 %
> >>>>%%%% <ya...@ieee.org> % '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'
> >>%%%% <ya...@ieee.org> % *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
Reply by glen herrmannsfeldt●September 19, 20082008-09-19
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
>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
Reply by Darol Klawetter●September 18, 20082008-09-18
On Sep 17, 8:30 pm, spop...@speedymail.org (Steve Pope) wrote:
> <ste...@coppice.org> 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.
Reply by Ken Asbury●September 18, 20082008-09-18
On Sep 17, 9:30�pm, spop...@speedymail.org (Steve Pope) wrote:
> <ste...@coppice.org> 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
>> 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
Reply by ●September 17, 20082008-09-17
On Sep 18, 1:00�am, spop...@speedymail.org (Steve Pope) wrote:
> Ken Asbury �<avoidingspam2...@yahoo.com> wrote:
>
> >On Sep 17, 11:11�am, Randy Yates <ya...@ieee.org> wrote:
> >> Ken Asbury <avoidingspam2...@yahoo.com> 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
Reply by Steve Pope●September 17, 20082008-09-17
Ken Asbury <avoidingspam2001@yahoo.com> wrote:
>On Sep 17, 11:11�am, Randy Yates <ya...@ieee.org> wrote:
>> Ken Asbury <avoidingspam2...@yahoo.com> 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.
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
Reply by Randy Yates●September 17, 20082008-09-17
Ken Asbury <avoidingspam2001@yahoo.com> writes:
> On Sep 17, 11:11�am, Randy Yates <ya...@ieee.org> wrote:
>> Ken Asbury <avoidingspam2...@yahoo.com> writes:
>> > On Sep 17, 10:40�am, Randy Yates <ya...@ieee.org> wrote:
>> >> knight <krshe...@gmail.com> 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 � � � � � � � �%
>> >> %%%% <ya...@ieee.org> � � � � � % � � � �'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'
>> %%%% <ya...@ieee.org> � � � � � % *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..."
%%%% <yates@ieee.org> % Getting To The Point', *Balance of Power*, ELO
http://www.digitalsignallabs.com