Is it possible to write 0.5 in binary format?

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.
Jan 31, 2002
40,819
2
0
Originally posted by: Howard
Originally posted by: ndee
it's 0.1 but I don't know why, I thought wrong. Cuz according to my logic, 1/4 would also be 0.1 but that's wrong, it would be 0.01, no idea why thought.
Skipped over my post, eh?

Nah, he just sucks at math. :p

- M4H
 

dabuddha

Lifer
Apr 10, 2000
19,579
17
81
Originally posted by: Pepsi90919
Originally posted by: dighn
Originally posted by: Pepsi90919

i've always done it by inverting the number and adding 1 to get a 2's complement number, then adding the other number.

yeah but you could do it the "natural" way too...

enlighten me?




11001100 (204)
- 110110 (54)
-------------------
10010110 (150)


It's simple and straight forward.

Or an easier example

110 (6)
-10 (2)
-----
100 (4)
 

ndee

Lifer
Jul 18, 2000
12,680
1
0
Originally posted by: Howard
Originally posted by: ndee
it's 0.1 but I don't know why, I thought wrong. Cuz according to my logic, 1/4 would also be 0.1 but that's wrong, it would be 0.01, no idea why thought.
Skipped over my post, eh?

I was typing that post already but you were right :)
 

ndee

Lifer
Jul 18, 2000
12,680
1
0
Originally posted by: MercenaryForHire
Originally posted by: Howard
Originally posted by: ndee
it's 0.1 but I don't know why, I thought wrong. Cuz according to my logic, 1/4 would also be 0.1 but that's wrong, it would be 0.01, no idea why thought.
Skipped over my post, eh?

Nah, he just sucks at math. :p

- M4H

That's true, that's why I'm asking so many Math threads lately, which I'm sure you noticed ;)
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
One more point to make. Writing 1/10 in binary requires an infinite number of repeating digits.
 

chiwawa626

Lifer
Aug 15, 2000
12,013
0
0
.5 in hex is: 3F000000
.5 in binary is: 0011 1111 0000 0000 0000 0000 0000 0000

Its called IEEE 754 Floating Point Format.

just for fun, something like -13.5625 would be:

hex: C15A0000
binary: 1100 0001 0101 0000 0000 0000 0000 0000