-1

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.

Cave Johnson
  • 4,270
khan
  • 213

1 Answers1

2

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.

高田航
  • 2,125
  • 13
  • 30
  • So we can generalize that multiplying with 10^n (where n = number of digits after 0) will give the whole number? – khan Jul 30 '18 at 01:18
  • Right. You should try a few examples on your calculator to see that it works. – 高田航 Jul 30 '18 at 01:19
  • Thanks so much for the help. Appreciated. – khan Jul 30 '18 at 01:20
  • 1
    It’s even simpler than that. Given a number $x$, and an integer $d$, you can form the approximation of $x$ as a fraction $$x\approx\frac{\lfloor dx \rfloor}{d}$$ where $\lfloor\cdot\rfloor$ just rounds down to an integer. – MPW Jul 30 '18 at 01:40
  • @MPW I was answering "is there a generalized way to determine what power of 10 to multiply with the fraction to convert it to a whole number?" – 高田航 Jul 30 '18 at 01:43
  • Yes, +1 for your answer. I was commenting that there is a more general interpretation. – MPW Jul 30 '18 at 01:45