-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
max_decimal_places
in Decimal field are wrong calculated
#2947
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
Milestone
Comments
So things that would help here:
|
@tomchristie I added PR with example and solution. Hope PR is valid! |
This was referenced Mar 9, 2017
This was referenced Oct 16, 2017
This was referenced Nov 6, 2017
This was referenced Nov 14, 2017
This was referenced Dec 10, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We got an issue when number is formatted as
decimal.Decimal('2E+9')
.How
DecimalField
counts decimals:However result of
decimal.Decimal('2E+9').as_tuple()[2]
is 9, which is ok, but there are no decimal places in this number.My solution is to not do
abs
and instead multiply by-1
.I can prepare PR tonight if you think it is valid.
The text was updated successfully, but these errors were encountered: