Support BigDecimal comparison with and initialization from BigRational#5675
Merged
asterite merged 1 commit intocrystal-lang:masterfrom Feb 10, 2018
Merged
Conversation
RX14
approved these changes
Feb 2, 2018
|
|
||
| # Creates a new `BigDecimal` from `BigRational`. | ||
| def initialize(num : BigRational) | ||
| initialize(num.to_f64) |
Member
There was a problem hiding this comment.
How about num.numerator.to_big_d / num.denominator.to_big_d?
5477b41 to
ac84c3b
Compare
RX14
requested changes
Feb 2, 2018
| end | ||
|
|
||
| # Creates a new `BigDecimal` from `BigRational`. | ||
| def initialize(num : BigRational) |
Member
There was a problem hiding this comment.
but why not make this a self.new then you can just return the original number instead of copying the value and scale...
Contributor
Author
There was a problem hiding this comment.
True indeed, I've forgot about that, thx! force-pushed again
ac84c3b to
7503522
Compare
RX14
approved these changes
Feb 2, 2018
Contributor
Author
|
Is it GTG? Could we have a 2nd review here? |
asterite
approved these changes
Feb 10, 2018
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows below code to work: