[Django] #30761: The floatformat filter sometimes returns "-0" instead of "0"

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #30761: The floatformat filter sometimes returns "-0" instead of "0"

Django
#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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/057.25a4f8216a54aceacfe2e414ac030a44%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30761: The floatformat filter sometimes returns "-0" instead of "0"

Django
#30761: The floatformat filter sometimes returns "-0" instead of "0"
-------------------------------------+-------------------------------------
     Reporter:  Sky Christensen      |                    Owner:  Sky
                                     |  Christensen
         Type:  Bug                  |                   Status:  assigned
    Component:  Template system      |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sky Christensen):

 * owner:  Sky Christensen => Sky Christensen


--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:1>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.189467a4ba2bb82ae94e0d8d7d03af60%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30761: The floatformat filter sometimes returns "-0" instead of "0". (was: The floatformat filter sometimes returns "-0" instead of "0")

Django
In reply to this post by Django
#30761: The floatformat filter sometimes returns "-0" instead of "0".
-------------------------------------+-------------------------------------
     Reporter:  Sky Christensen      |                    Owner:  Sky
                                     |  Christensen
         Type:  Bug                  |                   Status:  closed
    Component:  Template system      |                  Version:  2.2
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * status:  assigned => closed
 * resolution:   => wontfix


Comment:

 I don't think it's an issue, this behavior is consistent with builtin
 `round()` and `-0` exists in floating-point arithmetic.

--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:2>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.71bc39e1fe3cf59aff02f6b494c510b8%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30761: The floatformat filter sometimes returns "-0" instead of "0".

Django
In reply to this post by Django
#30761: The floatformat filter sometimes returns "-0" instead of "0".
-------------------------------------+-------------------------------------
     Reporter:  Sky Christensen      |                    Owner:  Sky
                                     |  Christensen
         Type:  Bug                  |                   Status:  new
    Component:  Template system      |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sky Christensen):

 * status:  closed => new
 * resolution:  wontfix =>


Comment:

 Re-opening following a discussion on the django-developers mailing list.

--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:3>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.8b227faf04330b133b87a58673d60d6f%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30761: The floatformat filter sometimes returns "-0" instead of "0".

Django
In reply to this post by Django
#30761: The floatformat filter sometimes returns "-0" instead of "0".
-------------------------------------+-------------------------------------
     Reporter:  Sky Christensen      |                    Owner:  Sky
                                     |  Christensen
         Type:  Bug                  |                   Status:  assigned
    Component:  Template system      |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sky Christensen):

 * status:  new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:4>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.a804800ac73e3267fb78baea4585953e%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30761: The floatformat filter sometimes returns "-0" instead of "0".

Django
In reply to this post by Django
#30761: The floatformat filter sometimes returns "-0" instead of "0".
-------------------------------------+-------------------------------------
     Reporter:  Sky Christensen      |                    Owner:  Sky
                                     |  Christensen
         Type:  Bug                  |                   Status:  assigned
    Component:  Template system      |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * stage:  Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:5>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/072.fb82332e37b9be785d73bef832108551%40djangoproject.com.