title: How can i format a decimal to a fraction with limits to the denominator
body: <p>Hi All I am trying to format a decimal A into a fraction B + C/D, where certain limit is imposed on D, say D could be one among [2...9] or [2...19] etc. BCD are integers
  The goal is to  get the formatted fraction as close to the decimal as possible.
  Is there an existing algorithm/theory on this?
  Or is there any API I can call on Mac SDK?</p>