{{{
#!python
>>> from django.template import Template, Context
>>> Template('{{ 999999999999999999999999999 }}').render(Context())
u'1000000000000000013287555072'
}}}
This happens because the code tries to first convert literal values to a
**float** and then from the **float** to an **int**, which is a lossy
operation.
--
Ticket URL: <https://code.djangoproject.com/ticket/28730>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Uncategorized => Bug
--
Ticket URL: <https://code.djangoproject.com/ticket/28730#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/28730#comment:2>
* has_patch: 0 => 1
* version: 1.11 => master
Comment:
[https://github.com/django/django/pull/9267 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28730#comment:3>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/28730#comment:4>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"9ec7d8e514e09636b0ab4bcac74b5f7a5be335a3" 9ec7d8e]:
{{{
#!CommitTicketReference repository=""
revision="9ec7d8e514e09636b0ab4bcac74b5f7a5be335a3"
Fixed #28730 -- Fixed loss of precision for large integer literals in
templates
Thanks Fraser Nevett for the report and Tim Graham for patch edits.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28730#comment:5>