| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The numerator and denominator need to be BigInteger, so request them as such and reuse those instances. This reduces the number of BigIntegers constructed to four in the case where they are both already RubyBignum instances and numerator is less than denominator, and eight in the worst case where neither of them are RubyBignum instances and numerator is greater than denominator. Previously, the best case was six BigInteger (extra from numerator and denominator being recreated).
If numerator == denominator, we don't need to do any of this math and can avoid constructing any objects.
| Back | FazBrowse Home | New Git URL |
The numerator and denominator need to be BigInteger, so request them as such and reuse those instances. This reduces the number of BigIntegers constructed to four in the case where they are both already RubyBignum instances and numerator is less than denominator, and eight in the worst case where neither of them are RubyBignum instances and numerator is greater than denominator.
Previously, the best case was six BigInteger (extra from numerator and denominator being recreated).