Skip to content
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

feat: add DecApproxEq to decimal #10592

Merged
merged 11 commits into from
Nov 30, 2021
Merged

feat: add DecApproxEq to decimal #10592

merged 11 commits into from
Nov 30, 2021

Conversation

pwang00
Copy link
Contributor

@pwang00 pwang00 commented Nov 23, 2021

Description

Closes: #10500

Modified decimal.go to add a DecApproxEq function that checks to see if |d1 - d2| < tol for some Dec d1, d2, tol.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@pwang00 pwang00 changed the title Address issue 10500 build: address issue 10500 Nov 23, 2021
@pwang00 pwang00 changed the title build: address issue 10500 feat: address issue 10500 Nov 23, 2021
@tac0turtle tac0turtle changed the title feat: address issue 10500 feat: add DecApproxEq to decimal Nov 23, 2021
@amaury1093 amaury1093 self-assigned this Nov 25, 2021
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@tac0turtle tac0turtle added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 26, 2021
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests (or their comments) seem a bit off

CHANGELOG.md Outdated Show resolved Hide resolved
types/decimal_test.go Outdated Show resolved Hide resolved
types/decimal_test.go Outdated Show resolved Hide resolved
@pwang00 pwang00 requested a review from amaury1093 November 27, 2021 04:17
Copy link
Contributor

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

types/decimal_test.go Outdated Show resolved Hide resolved
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
@alexanderbez
Copy link
Contributor

@pwang00 can you fix the build (just saving the test file should do it) and I'll get this merged 👍

@pwang00
Copy link
Contributor Author

pwang00 commented Nov 30, 2021

@pwang00 can you fix the build (just saving the test file should do it) and I'll get this merged +1

Do you mean saving the test file locally and then repushing?

@alexanderbez
Copy link
Contributor

@pwang00 can you fix the build (just saving the test file should do it) and I'll get this merged +1

Do you mean saving the test file locally and then repushing?

you need to fix the build -- i.e. you need to add the correct import statement to the test file ;-)

@pwang00
Copy link
Contributor Author

pwang00 commented Nov 30, 2021

@pwang00 can you fix the build (just saving the test file should do it) and I'll get this merged +1

Do you mean saving the test file locally and then repushing?

you need to fix the build -- i.e. you need to add the correct import statement to the test file ;-)

Oops, issue should be resolved now.

@mergify mergify bot merged commit 90562c9 into cosmos:master Nov 30, 2021
blewater pushed a commit to e-money/cosmos-sdk that referenced this pull request Dec 8, 2021
<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes: cosmos#10500

Modified `decimal.go` to add a `DecApproxEq` function that checks to see if |d1 - d2| < tol for some `Dec` d1, d2, tol.  

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a Decimal ApproxEq function
5 participants