Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extra: Add getter methods to extra::rational::Ratio
After merging 0ada7c7, user code have not been able to access to `Ratio`'s numerator and denominator fields. In some algorithms, it is needed to get an rational number's numerator or denominator, but keeping these fields private is necessary for guaranteeing that `Ratio` numbers are irreducible. So, I added the getter methods `numer()` and `denom()`. As a bonus, this commit adds utility methods relating to the ratio-integer conversion.
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from pcwalton
at https://github.com/gifnksm/rust/commit/7d5c7b8083acc8fe6bb466bb11c60d597384f978
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging gifnksm/rust/ratio-methods = 7d5c7b8 into auto
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gifnksm/rust/ratio-methods = 7d5c7b8 merged ok, testing candidate = 8d895da8
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2184
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from pcwalton
at https://github.com/gifnksm/rust/commit/7d5c7b8083acc8fe6bb466bb11c60d597384f978
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging gifnksm/rust/ratio-methods = 7d5c7b8 into auto
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gifnksm/rust/ratio-methods = 7d5c7b8 merged ok, testing candidate = 4d2f2dc6
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1294
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2187
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from pcwalton
at https://github.com/gifnksm/rust/commit/7d5c7b8083acc8fe6bb466bb11c60d597384f978
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging gifnksm/rust/ratio-methods = 7d5c7b8 into auto
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gifnksm/rust/ratio-methods = 7d5c7b8 merged ok, testing candidate = cb5b21e
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2190
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-c/builds/36
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-t/builds/36
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2194
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/1300
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1299
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2208
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1300
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1300
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2209
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1300
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1300
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/1378
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2193
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1298
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1300
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/1974
7d5c7b8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = cb5b21e