Opened 3 years ago

Last modified 3 years ago

#32955 closed Bug

widthratio does not round properly — at Initial Version

Reported by: alfonsrv Owned by: nobody
Component: Template system Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation states, quote

175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88

Using the example provided in the official documentation produces 88px. However when dividing 5/2, it results in 2 instead of what I would expect to be 3.

{% widthratio 5 2 1 as width %}
The width is: {{ width }} {# results in 2 instead of 3 #}

https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#:~:text=87.5%20which%20is%20rounded%20up%20to%2088

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top