Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how could I specify the No. of bit that represent the No.????

Subject: how could I specify the No. of bit that represent the No.????

From: luma

Date: 22 Nov, 2012 22:32:08

Message: 1 of 8

Hello,
How could I specify the No.of bit that represent
for ex.
X=156.102
I need to specify 16 bit for integer and 8 bit for fractional.
Please,I need the answer to my question so much.

Subject: how could I specify the No. of bit that represent the No.????

From: Roger Stafford

Date: 22 Nov, 2012 23:47:07

Message: 2 of 8

"luma " <luma.hamdi@ymail.com> wrote in message <k8m958$ltl$1@newscl01ah.mathworks.com>...
> How could I specify the No.of bit that represent
> for ex.
> X=156.102
- - - - - - - - -
  It isn't clear what you are asking. In what connection do you need to "specify" bit lengths? Are you working with the Fixed Point Toolbox? It would require infinitely many binary bits to represent the number 156.102 exactly, so you would need to settle for an approximation; the more bits, the more accurate the approximation.

Roger Stafford

Subject: how could I specify the No. of bit that represent the No.????

From: Nasser M. Abbasi

Date: 23 Nov, 2012 00:29:25

Message: 3 of 8

On 11/22/2012 5:47 PM, Roger Stafford wrote:
> "luma " <luma.hamdi@ymail.com> wrote in message <k8m958$ltl$1@newscl01ah.mathworks.com>...
>> How could I specify the No.of bit that represent
>> for ex.
>> X=156.102
> - - - - - - - - -

> Are you working with the Fixed Point Toolbox? It would require infinitely
>many binary bits to represent the number 156.102 exactly,

in fixed points? Would that not be 156102 with scaling factor 1/1000 ?

--Nasser

Subject: how could I specify the No. of bit that represent the No.????

From: luma

Date: 23 Nov, 2012 00:54:07

Message: 4 of 8

"luma " <luma.hamdi@ymail.com> wrote in message <k8m958$ltl$1@newscl01ah.mathworks.com>...
> Hello,
> How could I specify the No.of bit that represent
> for ex.
> X=156.102
> I need to specify 16 bit for integer and 8 bit for fractional.
> Please,I need the answer to my question so much.

yes , I used fixed point
I used fi function but I don't think it is useful.
I need to specify the No. of bit and then convert the matrix to text.
finally, I stored it in memory of FPGA

Subject: how could I specify the No. of bit that represent the No.????

From: Roger Stafford

Date: 23 Nov, 2012 03:15:08

Message: 5 of 8

"luma " <luma.hamdi@ymail.com> wrote in message <k8mhff$ib7$1@newscl01ah.mathworks.com>...
> "luma " <luma.hamdi@ymail.com> wrote in message <k8m958$ltl$1@newscl01ah.mathworks.com>...
> > How could I specify the No.of bit that represent
> > for ex.
> > X=156.102
- - - - - - - - -
  Luma, I don't understand what you mean when you ask "How could I specify the No. of bit that represent for ex. X=156.102". Are you asking how to convert decimal numbers into binary form? Are you asking how many bits would be required to do that? The answer to such questions would all depend on the format and accuracy in which the numbers are to be represented as well as their magnitude. Please explain your request in much, much greater detail. Show us some specific examples of what you wish to do.

Roger Stafford

Subject: how could I specify the No. of bit that represent the No.????

From: luma

Date: 23 Nov, 2012 21:25:08

Message: 6 of 8

"Roger Stafford" wrote in message <k8mpns$eoq$1@newscl01ah.mathworks.com>...
> "luma " <luma.hamdi@ymail.com> wrote in message <k8mhff$ib7$1@newscl01ah.mathworks.com>...
> > "luma " <luma.hamdi@ymail.com> wrote in message <k8m958$ltl$1@newscl01ah.mathworks.com>...
> > > How could I specify the No.of bit that represent
> > > for ex.
> > > X=156.102
> - - - - - - - - -
> Luma, I don't understand what you mean when you ask "How could I specify the No. of bit that represent for ex. X=156.102". Are you asking how to convert decimal numbers into binary form? Are you asking how many bits would be required to do that? The answer to such questions would all depend on the format and accuracy in which the numbers are to be represented as well as their magnitude. Please explain your request in much, much greater detail. Show us some specific examples of what you wish to do.
>
> Roger Stafford

hello, Roger
I mean that the integer of x=156 and I need only 8 bit to represent the no. in good accuracy and x=0.102 the fractional could be represent good accuracy in 7 bit only . and then I don't need more than (8+7=15) 15 bit to represent x .
I wish it will be clear

Subject: how could I specify the No. of bit that represent the No.????

From: dpb

Date: 23 Nov, 2012 22:32:12

Message: 7 of 8

On 11/23/2012 3:25 PM, luma wrote:
...

> hello, Roger I mean that the integer of x=156 and I need only 8 bit to
> represent the no. in good accuracy and x=0.102 the fractional could be
> represent good accuracy in 7 bit only . and then I don't need more than
> (8+7=15) 15 bit to represent x .
> I wish it will be clear

Like Roger, I'm totally confused as to what you're really trying to say
here...but

Are you saying you're trying to represent the integer and fractional
portion of a value as the integer value of each in two separate bit
fields so that the internal storage could be

bit positions 1-15
11111100 0000000
54321098 7654321

10011100.1100110

where the decimal is an implied one????

If not, try again in complete detail to explain what it is you are
trying to do...

--

Subject: how could I specify the No. of bit that represent the No.????

From: Roger Stafford

Date: 23 Nov, 2012 23:08:08

Message: 8 of 8

"luma " <luma.hamdi@ymail.com> wrote in message <k8opjk$9j5$1@newscl01ah.mathworks.com>...
> I mean that the integer of x=156 and I need only 8 bit to represent the no. in good accuracy and x=0.102 the fractional could be represent good accuracy in 7 bit only . and then I don't need more than (8+7=15) 15 bit to represent x .
- - - - - - - - -
  You have (more or less) indicated that you know how to calculate the number of bits required to store a number like 156.102 . However, it isn't at all evident what you are attempting to find out in this thread. What do you want to learn that you don't already know? As dpb asks, please give us "complete details". You have yet to do that!

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us