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

classic Classic list List threaded Threaded
10 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.
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:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sky Christensen):

 * has_patch:  0 => 1


Comment:

 https://github.com/django/django/pull/11997

--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:6>
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.5da8d44e292454c1ebded04561fa4738%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:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

 * needs_better_patch:  0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:7>
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.b170d5c0e8638713cc0f530cca4e8296%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:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * needs_better_patch:  1 => 0


Comment:

 [https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!searchin
 /django-developers/floatformat%7Csort:date/django-
 developers/n6Qtwi3N60g/De6wJ4FFBAAJ Discussion]

--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:8>
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.c8d9634b59a869ebd601219a8e1bd64a%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:  closed
    Component:  Template system      |                  Version:  2.2
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

 In [changeset:"3cf907c20c4f4d94f649fbb93a006af5c61b30b8" 3cf907c2]:
 {{{
 #!CommitTicketReference repository=""
 revision="3cf907c20c4f4d94f649fbb93a006af5c61b30b8"
 Fixed #30761 -- Prevented floatformat filter from returning a negative
 zero.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30761#comment:9>
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.ae4da77bde9c197064c135c691bd8c10%40djangoproject.com.