2

I would now like to know how to convert a value in base2 scientific notation (is that the correct terminology?), say 1.93 * 2 ^ 88, into the form of A * 10 ^ B.

I want to do this without expressing the first form as a complete number and converting it back to the 2nd form.

I can get by exponent by doing 88 * (ln2 / ln10) = 26.49...

So I have A * 10 ^ 26 now.

How can I solve for A?

Complete equation: 1.93 * 2 ^ 88 = A * 10 ^ 26.


This has been moved/duplicated from https://softwareengineering.stackexchange.com/questions/231692/converting-base2-scientific-notation-to-base10-scientific-notation.

Damien
  • 23

2 Answers2

3

I am not sure I properly understood your problem; so, forgive me if what I write is just stupid.

You want to convert $a 2^b$ to $c 10^d$. Obviously, you noticed that $d=\lfloor \log (a 2^b)\rfloor$. So, now you need $c$ which is given by $c=a 10^{-d} 2^{b}$ what you get easily using logarithms.

Please tell me if I understood or not the problem.

  • Yes, that works, thankyou. I'll need to take some time to understand why this works though. – Damien Mar 08 '14 at 16:25
  • You are welcome. You got the key part which is $d$. The remaining is just relevant from logarithms. – Claude Leibovici Mar 08 '14 at 16:26
  • @Damien - I had to re-lookup the definition of a Logarithm even after minoring in Math (7 years ago). The logarithm operation simply receives a numerical input and outputs the number of significant digits present in that number (Log base 10 of 100 is 2, of 1000 is 3, etc...). After remembering this Claude's equations are obvious and then you're just solving a system of 2 equations. https://en.wikipedia.org/wiki/Logarithm – Ian Oct 23 '17 at 18:35
0

I would take a slightly different approach: solve for both the significand and exponent concurrently.

Suppose the original number is $S \times 2^n.$ First convert the entire number into a base-ten logarithm like this:

\begin{align} X &= \log_{10} (S \times 2^n) \\ &= \log_{10} (S) + \log_{10}(2^n) \\ &= \log_{10} (S) + n\log_{10}(2) \\ &= \frac{\ln(S)}{\ln(10)} + n \frac{\ln(2)}{\ln(10)}. \end{align}

Now the original number is $10^X.$ To express this in scientific notation, let \begin{align} k &= \lfloor X \rfloor, \\ M &= X - k, \\ A &= 10^M, \end{align}

and in this way we find that $S \times 2^n = A \times 10^k.$

Applying this to your example, \begin{align} X &= \log_{10}(1.93 \times 2^{88}) \\ &= \frac{\ln(1.93)}{\ln(10)} + 88 \frac{\ln(2)}{\ln(10)} \\ &\approx 0.285557 + 88 \times 0.301030 \\ &\approx 26.7762 \end{align}

Since $10^{0.7762} \approx 5.97,$ the result is $$ 1.93 \times 2^{88} = 5.97 \times 10^{26}. $$

David K
  • 98,388