# Convert number from one base to another

I have the next number: $$5.2880001*10^{-4}$$

Now I want to convert this number to a format of $X*2^y$. How I do it?

Thank you.

-

3
Are there any constraints on X and y? Otherwise you can always take X to be your number (0.00052880001) and y to be 0. – ShreevatsaR Jul 9 '11 at 9:34

## 2 Answers

Assuming that you want to follow a convention corresponding to the one that's used for decimal numbers (namely that X has a single non-zero digit before the decimal/binary point), you need

$$\begin{eqnarray} y&=&\lfloor\log_2s\rfloor\;,\\ X&=&2^{-y}s\;, \end{eqnarray}$$

where $s$ is your number, $\log_2$ is the base-$2$ logarithm and $\lfloor\cdot\rfloor$ is the floor function, which yields the greatest integer not greater than its argument.

If you don't have means for calculating logarithms available, you can just multiply or divide (in this case multiply) your number by $2$ until you cross $1$ to determine $y$.

-

I assume you want $1 \le X \lt 2$ and $y$ to be an integer.

You could write your expression as $0.00052880001\times 2^0$ or $0.00105760002\times 2^{-1}$ or $0.00211520004\times 2^{-2}$ and so on by doubling the left part and changing the index on the right, including $1.08298242048\times 2^{-11}$.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 14, "mathjax_display_tex": 2, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9220412969589233, "perplexity_flag": "head"}