Convert a fraction to whole number

64 Views Asked by At

Lets say that there are a few fractions:

x = 0.584592145015
y = 0.443242244323

How do one convert these fractions to whole numbers? That is:

xw = 584592145015
yw = 443242244323

The point is that the fraction can be upto any amount of precision. Is there a generalized way to determine what power of 10 to multiply with the fraction to convert it to a whole number?

Thanks.

1

There are 1 best solutions below

6
On

You can think about it this way: Each power of $10$ "moves" the decimal point one place to the right. For example: $$0.00002\times10^5=2$$ For the two numbers in your problem, you can multiply them by $10^{12}$ to get whole numbers, since there are $12$ digits past the decimal point in each number.