[Math] Determine fraction of inch from decimal

fractions

I am working with data for the width and height of books. The data is in decimal form, such as 7.563, which I need to display as a fraction: 7 9/16 in.

The denominator can vary and the decimal value isn't always rounded the same. Here is some sample data and the converted values:

6.438     6 7/16 in.
4.625     4 5/8 in.
7.62      7 5/8 in.
11.0      11 in.
5.68      5 11/16 in.
8.688     8 11/16 in.
4.25      4 1/4 in.

I need the denominators to be integers commonly used for inches. For example, .18 would convert to 3/16 rather than something like 9/50 as shown in this answer.

Is there a formula I can use to do this conversion?

Best Answer

When you work in inches, the only common fractions are powers of $2$. The challenge is where to stop. We know $\frac 12=0.50000$ and $\frac {15}{32}=0.46875$ How close do you need to be to $0.50000$ to decide that the true answer is not some larger denominator? This is not a mathematical question. Certainly if I saw $0.499999995$ I would think it was more likely $\frac 12$ than some fraction with a very large denominator. If I saw $0.48$ I wouldn't be sure whether I should round it to $\frac 12$ or $\frac {15}{32}$. It is closer to $\frac {15}{32},$ but $\frac 12$ is so much more common. If your data comes from people with rulers, I would be confident that no measurement is reported to better than $\frac 1{32}$ inch, so I would round to the closest one of those. Your data are all good to within $\pm 0.01$ inch, which will allow you to find the closest thirty-second. Count your blessings.

Related Question