4 Replies - 1712 Views - Last Post: 14 October 2007 - 05:34 PM Rate Topic: -----

#1 jack85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 28-September 07

binary number

Post icon  Posted 13 October 2007 - 11:32 AM

A guys how do you convert 2.2(dec) to binary number.


And how can I find a chart that I can check my results.


Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: binary number

#2 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: binary number

Posted 13 October 2007 - 11:52 AM

There are a lot of ways to do so, a bunch of IEEE standards and so. You can use either fixed or floating point notation. Do you have any specific requirements?

Here is a Wiki kickstart
Was This Post Helpful? 0
  • +
  • -

#3 jack85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 28-September 07

Re: binary number

Posted 13 October 2007 - 12:02 PM

View Post1lacca, on 13 Oct, 2007 - 11:52 AM, said:

There are a lot of ways to do so, a bunch of IEEE standards and so. You can use either fixed or floating point notation. Do you have any specific requirements?

Here is a Wiki kickstart




The requirements are: Write a conversion program for a decimal number to binary and vice versa. Binary numbers are of 16 bits: Write a conversion program for a decimal number to binary and vice versa. Binary numbers are of 16 bits: 8 bits for the whole number and 8 bits for the decimal part.

I have a program decimal to binary(only regular numbers).
I just need to add 16 bites and Write a conversion program for a decimal number to binary and vice versa. Binary numbers are of 16 bits: 8 bits for the whole number and 8 bits for the decimal part.

Thanks
Was This Post Helpful? 0
  • +
  • -

#4 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: binary number

Posted 13 October 2007 - 12:35 PM

Then use fix point notation, and simply multiply the rational number with 2^8 and take the integer part. Now you can use your program to convert it to binary.
Converting back is the same: use your program to convertthe binary form to decimal, and divide it with 2^8 converting the result to a float (some precision will be lost, and also, it won't be as efficient as the floating point notation, but it is simple)
Was This Post Helpful? 0
  • +
  • -

#5 Programmist  Icon User is offline

  • CTO
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,833
  • Joined: 02-January 06

Re: binary number

Posted 14 October 2007 - 05:34 PM

Or you could Google it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1