storing decimal number into computer with finite mantissa

52 Views Asked by At

I am learning about numerical methods and the following link caught my attention:

https://www.iro.umontreal.ca/~mignotte/IFT2425/Disasters.html

So from what I understand 0.1 is not exactly representable in binary. But what about representing it in bases less than 10 other than base 2? Would that give the same result? I tried to research 0.1 representation in ternary but I didn't find much. Is there no base less than decimal base 10 that would give finite mantissa for 0.1?

My main question is in what base system a given decimal-based number like 0.1 can be represented with a finite mantissa? Is that even possible?

1

There are 1 best solutions below

0
On BEST ANSWER

To have an exact representation of a number $x$ in base $\beta$ with finite mantissa means that we can write $ x = n \beta^m $ where $n$ and $m$ are integers.

For the particular case $0.1$, that means we can write $$ \frac{1}{10} = n \beta^m. $$

Multiply both sides by $10$ and divide by $\beta^m$:

$$ \beta^{-m} = 10n = 2 \cdot 5 \cdot n. $$

So $\beta^{-m}$ is an integer -- which is not a problem, just let $m \leq 0$ -- $\beta^{-m}$ is divisible by $2,$ and $\beta^{-m}$ is divisible by $5.$ As a consequence of the fundamental theorem of arithmetic, $\beta$ must be divisible by $2$ and by $5$, and therefore $\beta$ must be a multiple of $10.$

So $10$ is the smallest positive integer base in which to express $0.1$ exactly with a finite mantissa.


More generally, to find the smallest base in which a particular rational number is representable exactly with a finite mantissa, express the number as a fraction in lowest terms. Find the prime factors of the denominator. The base you need is the product of all the distinct prime factors, that is, if a prime occurs as a factor of the denominator more than once you only need to use it once in the base.