0
$\begingroup$

I have number -1e35 , and i am supposed to convert it to binary . the answer is : -1.10101001010110100101101...e–117 . I can't figure out how to get this ! and how we can calculate numbers partially as you see here. originally it is a programming practice , but what I care about is the mathematical part . i tried to solve it like this : log 10^35=log 2^x , the result is , 116.666 . my question is not exactly how to convert , i know how to convert smaller numbers , but i am confused with scientific notation , and how to represent part of the number .

$\endgroup$
  • $\begingroup$ Why is the binary exponent negative? $\endgroup$ – Ross Millikan Feb 3 '16 at 18:36
0
$\begingroup$

When you represent a number in decimal scientific notation, the base of the exponent is $10$, so $1E35=1\cdot 10^{35}$. In binary, the base is $2$, so you are trying to solve $1\cdot 10^{35}=m2^e$ where $1 \lt m \lt 10_2$ is the mantissa and $e$ is an integer exponent. To find $e$ we can take logs: $$1 \cdot 10^35 = m2^e\\ 35 \log_2(10)=e+ \log_2 (m)\\e=\lfloor35 \log_2(10)\rfloor=116_{10}$$ Now to get the mantissa you can just subtract off powers of $2$ $$10^{35}-2^{116}=16923250263442757943512058732478464\\ \lfloor \log_2(16923250263442757943512058732478464)\rfloor=113$$ so we start with $1.001_2$ because the exponent dropped by $3$ $$16923250263442757943512058732478464-2^{113}=6538656546373102686451066074038272\\ \lfloor \log_2(6538656546373102686451066074038272)\rfloor=112$$ so our mantissa becomes $1.0011_2$ and so on until you get tired, your word fills up, or you get to the end. The final answer is $$1.001101000010011000010111001011000111010011011000001000101011100001111000111111101_2E116$$

$\endgroup$
  • $\begingroup$ i am trying to repair the math part of my brain , I've been away for a long time , in the sentence : so we start with 1.001(2) , 2 is the base ?? $\endgroup$ – shayan Feb 3 '16 at 19:12
  • $\begingroup$ and another question , why you have rounded it to 116? $\endgroup$ – shayan Feb 3 '16 at 19:36
  • $\begingroup$ Yes, binary means base 2. I took the floor to get $116$. We have $2^{116} \lt 10^{35} \lt 2^{117}$ and want $1 \lt m \lt 2$. $\endgroup$ – Ross Millikan Feb 3 '16 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.