fix: legacy dec power mut zero exponent precision (#16266)

This commit is contained in:
Roman 2023-05-23 20:05:59 -04:00 committed by GitHub
parent 995d2bc94b
commit a2e3711ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,10 @@ Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.j
## [Unreleased]
### Bug Fixes
* [#16266](https://github.com/cosmos/cosmos-sdk/pull/16266) fix: legacy dec power mut zero exponent precision.
## [math/v1.0.1](https://github.com/cosmos/cosmos-sdk/releases/tag/math/v1.0.1) - 2023-05-15
### Improvements

View File

@ -490,7 +490,8 @@ func (d LegacyDec) Power(power uint64) LegacyDec {
func (d LegacyDec) PowerMut(power uint64) LegacyDec {
if power == 0 {
d.SetInt64(1)
// Set to 1 with the correct precision.
d.i.Set(precisionReuse)
return d
}
tmp := LegacyOneDec()