Hey Sup Forumsros, how do I convert a negative decimal with fractions into a binary number...

Hey Sup Forumsros, how do I convert a negative decimal with fractions into a binary number? My professor wasn't too clear on the instruction and when I sent him an email regarding it, he just sent me the answer.

Here's what he sent:

B = -1.79931640625 ∗ 10^1
B = - 17.9931640625
B = - 10001.11111110 * 2^0
B = 1.0111000010 * 2^-3

I know how he got to the third step, but from the third step to the fourth step there's a giant gap in my understanding. Can anyone explain it to me?

Bumpin for wizard stuff

What. Going from step 4 to step 3, his answer is provably wrong, because you multiply two positive numbers together and somehow get a negative number. I don't know what kind of nigger maths you're doing where that makes sense, but no. The correct version of line 4 would be:

B = 1.000111111110 * 2^-4

Unless I'm missing the obvious here?

Uh, forgot my negative sign, sorry.

You said from 4 to 3, did you mean 3 to 4? I don't mean to nitpick but I'm losing my goddamned mind at this point.

No. I'm trying to work backwards from 4 to 3. It doesn't make sense. How can you multiply two positive numbers and get a negative number?

Its similar to scientific notation, move the decimal left until the number is between 1 and 9.999... whilst counting how many times you move it left

Binary numbers are 2^n power.
2^0 = 1, when turned on
2^1 = 2, when turned on
so 11 = 3,
10 = 2,
01 = 1

Same goes for 2^-1, 2^-2, ... , 2^-n

so 2^-1 aka .1 would be 0.5
2^-2 aka .01 would be .25

so .11 = 0.75

Need anymore ?

In fact, you know what, I don't understand line 4 at all. The 2^-3 is wrong too... I think he copy-pasted the wrong answer or something. That's bullshit.

sorry op i did not read your post at all. i am drunk

i will reply with a better response soon

In the original he goes from -1.7 to -17 to the binary -10001. Now binary - means you preface it with 1 to let the comp know shiggle is going down. Past that though, I straight up have no idea how he went from step three to four.

No one said there's a computer involved. Binary is just base 2. If there's some different rules in comp sci due to the way an int is stored, then fair enough, but that's not what OP asked.

Whoa, can you break that down for me a bit more using a similar, but not necessarily same number to what I've posted? I've looked over this stuff for hours and I'm beyond confused at this point. You sound like you know exactly what's going on, but if you could I'd love a more comparable answer to what I had. Also, thank you very much.

Things to search:
Mantissa.
Radix.

- 10001.11111110
Before the radix from right to left, 2^0, 2^1, 2^2, etc. After radix. 2^-1, 2^-2, 2^-3, add that shit up and you get the base ten shit.

Are you working with negatives in binary?
Negatives are a bitch to work with in binary.

Are your binary numbers:

SIGNED
OR
2'S COMPLEMENT?

With the negative sign this guy is correct

They're negatives. Signed digits.

I believe we're just talking about binary here, as in base 2. You're confusing binary with specific encodings of binary.

If it helps, here is the entirety of the response from the teacher:

Representation of numbers in binary format:
A = -8.0546875 ∗ 10^0
A = -8.0546875
A = -1000.0000111 ∗ 2^0
A = -1.0000000111 ∗ 2^3
B = -1.79931640625 ∗ 10^1
B = - 17.9931640625
B = - 10001.11111110 * 2^0
B = 1.0111000010 * 2^-3
Add exponent without bias: 3 + (-3) = 0
Multiplication of significant:
1.0000000111
x 1.0111000010
00000000000
10000000111
00000000000
00000000000
00000000000
00000000000
1000000111
1000000111
1000000111
00000000000
1000000111
1.01110011000001001110
Guard bit is 0, round bit is 0, sticky bit is 1.
Convert: (1.0111001100)base 2 to decimal: (1.44921875)base 10
Calculate result using a calculator: -8.0546875 * -0.179931640625 = 1.44929313
Difference = Calculator Result – Hand Result
Difference = 1.4429313 – 1.44921875
Difference = 0.00007438

I'm confused. Shouldn't the last line have - at the front and be to the power of 4 not -3?

In signed binary, the first digit determines the sign, with 1 being negative and 0 being positive. If it's a positive number (0), the 0 will normally be omitted.

You posted your professor's answer, but you didn't post the question? I need to see the question to understand what's going on here exactly

also your professor sucks.
whatever the fuck he is doing he is making this way more complex than it needs to be, tell him to go get fucked by a group of niggers

Calculate the product of -8.0546875 * 10 ^ 0 and -1.79931640625 * 10 ^ 1 by hand. Assume A and B are stored in 16 bit half precision format. Assume one guard, one round and one sticky bit and round to the nearest even. Show all the steps, however you can do the multiplication in human readable format. Indicate if there is under/overflow. Indicate your answer in both 16 bit floating point format and also as a decimal. How accurate is your result? How does it compare to the number you get if you do the calculation on a calculator?

I am
I am a Computer Engineering student in his senior (final) year. I do not know why you are doing such complex binary mathematics but I cannot help you. I've never seen a question like this before.

I've never heard of "guard", "round", or "sticky" bits. I've also never had to compute binary multiplication by hand.

This website seems helpful, best of luck
www exploringbinary com/binary-multiplication/

Bumping cause wizard magic is cool

Yeah I googled this shit. Not sure if it's familiar. Definitely not something I ever need to think about in my job. If we did this in school it was very minor.

>Definitely not something I ever need to think about in my job
ikr, op should just tell his professor to go fuck himself

I don't think that'd help with my GPA much.