Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Co-authored-by: marbar3778 <marbar3778@yahoo.com>
This commit is contained in:
parent
ee589c81d4
commit
535567e231
@ -39,6 +39,7 @@ Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.j
|
||||
### Bug Fixes
|
||||
|
||||
* [#16266](https://github.com/cosmos/cosmos-sdk/pull/16266) fix: legacy dec power mut zero exponent precision.
|
||||
* [#18211](https://github.com/cosmos/cosmos-sdk/pull/18211) RelativePow now returns 1 when 0^0, before it was returning the scale factor.
|
||||
|
||||
## [math/v1.0.1](https://github.com/cosmos/cosmos-sdk/releases/tag/math/v1.0.1) - 2023-05-15
|
||||
|
||||
|
||||
@ -243,8 +243,8 @@ func checkNewUint(i *big.Int) (Uint, error) {
|
||||
func RelativePow(x, n, b Uint) (z Uint) {
|
||||
if x.IsZero() {
|
||||
if n.IsZero() {
|
||||
z = b // 0^0 = 1
|
||||
return
|
||||
z = OneUint() // 0^0 = 1
|
||||
return z
|
||||
}
|
||||
z = ZeroUint() // otherwise 0^a = 0
|
||||
return
|
||||
|
||||
@ -271,7 +271,7 @@ func (s *uintTestSuite) TestRelativePow() {
|
||||
want sdkmath.Uint
|
||||
}{
|
||||
{[]sdkmath.Uint{sdkmath.ZeroUint(), sdkmath.ZeroUint(), sdkmath.OneUint()}, sdkmath.OneUint()},
|
||||
{[]sdkmath.Uint{sdkmath.ZeroUint(), sdkmath.ZeroUint(), sdkmath.NewUint(10)}, sdkmath.NewUint(10)},
|
||||
{[]sdkmath.Uint{sdkmath.ZeroUint(), sdkmath.ZeroUint(), sdkmath.NewUint(10)}, sdkmath.NewUint(1)},
|
||||
{[]sdkmath.Uint{sdkmath.ZeroUint(), sdkmath.OneUint(), sdkmath.NewUint(10)}, sdkmath.ZeroUint()},
|
||||
{[]sdkmath.Uint{sdkmath.NewUint(10), sdkmath.NewUint(2), sdkmath.OneUint()}, sdkmath.NewUint(100)},
|
||||
{[]sdkmath.Uint{sdkmath.NewUint(210), sdkmath.NewUint(2), sdkmath.NewUint(100)}, sdkmath.NewUint(441)},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user