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

pydecimal mishandles max_value and min_value when used with left_digits/right_digits #2100

Closed
bdjellabaldebaran opened this issue Sep 4, 2024 · 0 comments · Fixed by #2101

Comments

@bdjellabaldebaran
Copy link
Contributor

  • Faker version: 28.1.0
  • OS: linux

Brief summary of the issue goes here.

Steps to reproduce

import faker

fake = faker.Faker()
faker.Faker.seed("6")
fake.pydecimal(left_digits=1, right_digits=1, max_value=0.3, min_value=0.2)
# returns Decimal('0.200000000000000011102230246251565404236316680908203125')
faker.Faker.seed("3")
fake.pydecimal(left_digits=1, right_digits=1, max_value=0.3, min_value=0.2)
# returns Decimal('0.299999999999999988897769753748434595763683319091796875')

Expected behavior

Faker should return Decimal('0.2') and Decimal('0.3')

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 a pull request may close this issue.

1 participant