Are there any restrictions when switching from binary to decimal (like when switching from decimal to binary)?

As we all know, not all decimal numbers can be represented in binary format (with a finite number of digits).

I am wondering if all (finite) binary numbers can be represented using (finite number) decimal digits? I suspect that since all the "primitives" in binary ("0.5", "0.125", etc.) can be represented with a finite number of decimal digits.

So my question is this: what characterizes a “compatible base change”? Ie, what are the mathematical properties that are saved for "Base 2 → Base 10" but not saved for "Base 10 → Base 2"?

(Put formally: what properties must N and M have to ensure that all finite Base-N numbers have the corresponding finite Base-M number?)

+6
source share
1 answer

If n is a binary fraction, then n = a / 2 k for the integers a and k.

This means that n = (a · 5 k ) / (2 k 5 k ) = (a · 5 k ) / 10 k

Thus, each binary fraction is a decimal fraction.

In the general case, each fraction to the base N is also a fraction for the base M if and only if N divides M k for some k (or, what is the same, if each prime factor N is also equal to the prime factor M). An argument similar to the one I gave above for 2 and 10 handles the if direction. For the “only if” direction, a preliminary proof is given here: suppose that 1 / N = a / M k then M k = a · N, therefore N divides M k .

Thus, the binary code can be converted to decimal without loss, because 2 is a factor of 10, but decimal cannot be converted to binary without losses, because 5 is a factor of 10, but not 2 times.

+14
source

Source: https://habr.com/ru/post/892025/


All Articles