50G fraction question Q-> function max denominator
|
11-08-2019, 08:43 PM
Post: #15
|
|||
|
|||
RE: 50G fraction question Q-> function max denominator
(11-08-2019 07:01 PM)Albert Chan Wrote: For x best estimate with maximum denominator D, *AND* final denominator divides D, simply calculate round(x D) / D Which is certainly another variation on the theme, but not quite the same thing I was focusing on (denominators whose value is specifically an integral power of 2). The context I'm thinking of here is something like a ruler which has score marks at 1, 1/2, 1/4, 1/8, 1/16, and 1/32 intervals for the units in question (for non-American viewers, this how most of our inch-based rulers are scored). Chain calculations with mixed decimals and fractions can be streamlined with a utility that provides this kind of function. I'm sure the brute-force method can be improved upon, but I would prefer an approach which gives the same kind of solution, ie. the closest approximation with the lowest power-of-2 denominator (up to the max allowed, of course). I realize this is a highly-specific application, but I believe it's still in the spirit of the original poster's intent. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)