Computer problems,Computer help
*AX SOFT>>>Programming & Design

How many bits will it take to represent a number of this type xxx.xx ?


That is, a number from 000.00 to 999.99

Thanks !!

I have to assume that you want a fixed point representation rather then a floating point one, because your format is xxx.xx and floating point is a very complicated formant.

Because this sounds a lot like a school assignment I'll show you how to solve a simpler version and let you solve the larger one on your own.

xx.x instead of xxx.xx or 00.0 to 99.9

Fixed point means that the number is stored as an integer, but it is assumed that it is always divided by a predetermined number. So if we wanted to save the number 99.9 from above we would assume that we are dividing by 10 and save the number as 999. The next thing we have to figure out is how many bits it would take to encode an integer that has a maximum value of 999 = 99.9 * 10. To do this we need to take the log base 2 of 999 which is 9.96 and round up to 10 because you cannot have part of a bit.

So there is the answer for 00.0 to 99.9, it takes 10 bits. Although in a modern computer you are probably going to need 16 bits because most computers have no way to deal with 10 bit numbers directly.

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • Anyone know about "The Missing Manual: Dreamweaver CS3"?

    that's not a bad book.. but to get into the industry you will need more than just that book.. it's a start for sure.. you would need to practice making sites - complex ones with css code,...

  • What u say about this design?

    it good but there is some thing missing i don't know what but good work

    ...
  • I/O files help with C++ programing?

    You should probably add some error handling but this code will work fine if everything is set up perfectly (e.g. the files exist, user enters proper information, file data is correct, etc.). Here&#...

  • BASH - How To (Replace specific text within a file)?

    #!/bin/bash time=14400 path=/somepath/somedirectory sed -e "s!%time%!$time!; s!%path%!$path!" template.txt > file.txt

    ...
  • Best practice looping through database columns or hardcode columnnames?

    Looping through a database by far is better. Because then if you want to expand you already have an object ready to handle it. Dynamic is the way to go.

    ...
  • Order online ! help.?

    You need a FormMail script. You just insert your e-mail address and the name of the Order Form File that you will design to accept details of your customer's order, and you will receive an e-...

  • How to terminate a Java while loop using a string?

    Your while condition will always evaluate to true. The expression str != "done" asks whether the reference str is different from the reference "done" - that is, do these ...

  • How do you automatically load a javascipt?

    Put the javascript in a file and in a subfolder of your project and then reference it in the header Example: <script language="javascript" src="scripts/general.js"><...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster