Skip to content

Commit

Permalink
fix: legacy dec power mut zero exponent precision (cosmos#16266)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn authored May 24, 2023
1 parent 995d2bc commit a2e3711
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions math/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion math/dec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a2e3711

Please sign in to comment.