Opened 3 years ago
Closed 3 years ago
#32955 closed Bug (invalid)
widthratio does not round properly
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 (last modified by )
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 #}
When using 7 instead of 5, the width results in the expected 4.
Change History (2)
comment:1 by , 3 years ago
Description: | modified (diff) |
---|
comment:2 by , 3 years ago
Easy pickings: | unset |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Type: | Uncategorized → Bug |
Note:
See TracTickets
for help on using tickets.
widthratio
uses built-inround()
on floats so it's not really a bug, see a note in round()'s docs.