"Bug in Rational.limitTo #" Issue

12 views
Skip to first unread message

Kevin Meredith

unread,
Apr 29, 2015, 10:06:58 PM4/29/15
to spire...@googlegroups.com
Per this bug, I see:

  /**
   * Returns a `Rational` whose denominator and numerator are no larger than
   * `max` and whose value is close to the original. This applies, even if, for
   * example, this `Rational` is greater than `max`. In that case,
   * `Rational(max, 1)` is returned.
   *
   * @param max A positive integer.
   */

    def limitTo(max: BigInt): Rational = ...

What's the meaning of "close to the original?"

Thanks

Tom Switzer

unread,
Apr 30, 2015, 10:23:17 AM4/30/15
to Kevin Meredith, Spire User List
In this case "close to the original" means that, given the constraints, there is no Rational that exists that is closer to the original number ((original - limited).abs = closeness) than the one returned.
Reply all
Reply to author
Forward
0 new messages