# how to convert decimal with scientefic notation , to binary?

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 .

• Why is the binary exponent negative? – Ross Millikan Feb 3 '16 at 18:36

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$$
• 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$. – Ross Millikan Feb 3 '16 at 20:12