You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently sleep(2 ** 2) results in a type error since 2 ** 2 returns Numeric type.
Because of these problems, it does not seem very convenient to set the return value to Numeric in numerical operations.
In this PR, I have made similar fixes to #** as those in Integer#pow.
It has been exhaustively tested in raap because the combination is complicated.
+1 for the good intention, but we should keep the (Numeric) -> branch as math operators accept any Numeric that coerce appropriately.
For the intention, we should go through all files and check for Numeric usages and specify known cases as appropriate.
Summon: @sampersand: you had PRs on numerics and they include making the sigs more pedanticexact.
@ParadoxV5
Thanks for the review. Indeed, with this change 1 ** BigDecimal(1) would result in a type error.
What about the idea of extending Integer#** from BigDecimal? Like + or -.
# bigdecimal.rbsclassIntegerdef **: (BigDecimal) -> BigDecimal
| ...
end
+1 for the good intention, but we should keep the (Numeric) -> branch as math operators accept any Numeric that coerce appropriately.
For the intention, we should go through all files and check for Numeric usages and specify known cases as appropriate. Summon: @sampersand: you had PRs on numerics and they include making the sigs more pedanticexact.
I hadn't gotten to around to doing integer.rbs, but maybe i should!
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
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.
Currently
sleep(2 ** 2)results in a type error since2 ** 2returnsNumerictype.Because of these problems, it does not seem very convenient to set the return value to
Numericin numerical operations.In this PR, I have made similar fixes to
#**as those in Integer#pow.It has been exhaustively tested in raap because the combination is complicated.