Opened 7 years ago
Last modified 7 years ago
#29130 closed Bug
Floatformat is rounding off incorrectly. — at Initial Version
Reported by: | Akash Deshpande | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.11 |
Severity: | Normal | Keywords: | template float filter |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I think the below changes broke/caused issues in floatformat
https://github.com/django/django/commit/12f7928f5a455e330c0a7f19bc86b37baca12811
Easiest way to replicate the issue is
- Create a simple view with a template
views.py
def test(request):
return render('test.html')
test.html
{{ 331.44999999999|floatformat:-1 }}
The above should return 331.5, but returns 331.4. This changed in django 1.11. (It returned 331.5 in django 1.8.X )
Note:
See TracTickets
for help on using tickets.