New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NSDecimalPower(_:_:_:_:)
behavior
#4799
base: main
Are you sure you want to change the base?
Conversation
@swift-ci test |
Either the tests or the implementation need to be updated as this test case fails on CI. |
- rename power to absPower - compare p to 0 and 1, instead of absPower (comparing absPower to 1 results in invalid results) - extract tests for negative power method to external test method - typecast test results to NSDecimalNumber in tests, since by default they were Int
@swift-ci test |
@swift-ci test windows |
@compnerd I'm not seeing this macOS CI failure on PRs that you merged recently. Would you agree that it's sporadic and unrelated to this change and that it can be safely merged? |
@MaxDesiatov I think it would be good to understand whats going on though, the macOS build has been somewhat fragile. |
@swift-ci please test macOS platform |
@swift-ci test macos |
1 similar comment
@swift-ci test macos |
@swift-ci test |
NSDecimalPower
acceptsInt
aspower
parameter, but internally it callspower(_:roundingMode:)
method, that accepts onlyUInt
as power value. That results in overflow error for every call ofNSDecimalPower
with negativepower
parameter.This PR fixes that behavior by modifying
power
method by makingp
an Int and adds additional code for handling negativep
.This PR solves #3237