# binary number

Page 1 of 1

## 4 Replies - 1843 Views - Last Post: 14 October 2007 - 05:34 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=35271&amp;s=97fdfbc1626c1c83fa48c1cc9d070c22&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 jack85

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

# binary number

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

• code.rascal

Reputation: 44
• 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

### #3 jack85

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

## Re: binary number

Posted 13 October 2007 - 12:02 PM

1lacca, 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

### #4 1lacca

• code.rascal

Reputation: 44
• 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)

### #5 Programmist

• Refactorer in Chief

Reputation: 254
• Posts: 1,841
• Joined: 02-January 06

## Re: binary number

Posted 14 October 2007 - 05:34 PM