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

Add round_to_nearest/3 #199

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

chrisapa
Copy link

What do you think about adding round_to_nearest/3?

Example:

iex> Decimal.round_to_nearest("47.1", 5)
        Decimal.new("45")

iex> Decimal.round_to_nearest("47.51", 5)
        Decimal.new("50")

@ericmj
Copy link
Owner

ericmj commented Mar 29, 2024

This looks good, but it would need expanding the documentation a bit to explain how it works.

I am not sure if it's common enough to add to the library. What are some use cases for this operation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants