round_to_fraction function

Round to the nearest fraction of a specified denominator.