#30761: The floatformat filter sometimes returns "-0" instead of "0"
-------------------------------------+-------------------------------------
               Reporter:  Sky        |          Owner:  Sky Christensen
  Christensen                        |
                   Type:  Bug        |         Status:  assigned
              Component:  Template   |        Version:  2.2
  system                             |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 For values between 0 and -0.5, the floatformat filter returns "-0" where I
 would expect it to return "0".

 For example:

 {{{
 $ python -m django --version
 2.2.5
 $ ./manage.py shell
 Python 3.5.3 (default, Sep 27 2018, 17:25:39)
 [GCC 6.3.0 20170516] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 (InteractiveConsole)
 >>> from django.template.defaultfilters import floatformat
 >>> floatformat(-0.1, 0)
 '-0'
 >>> floatformat(-0.01, 1)
 '-0.0'
 >>> floatformat(-0.001, 2)
 '-0.00'
 >>> floatformat(-0.4, 0)
 '-0'
 }}}

 If others agree that this is a bug, I'll submit a patch.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30761>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/057.25a4f8216a54aceacfe2e414ac030a44%40djangoproject.com.

Reply via email to