#35821: Integer fields silently round floats
----------------------------+-----------------------------------------
     Reporter:  Alex Krupp  |                     Type:  Bug
       Status:  new         |                Component:  Uncategorized
      Version:  5.1         |                 Severity:  Normal
     Keywords:              |             Triage Stage:  Unreviewed
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  1           |                    UI/UX:  0
----------------------------+-----------------------------------------
 I encountered a bug in my code today where I was trying to save 0.3 to a
 PositiveSmallIntegerField with an initial default value of zero, and the
 model kept showing zero even after saving it. This was super confusing
 because it looked like the model just wasn't saving, until I eventually
 realized that the value was being rounded.

 Suggested improvements would be either:

 1) Raise an error when attempting to save a non-Integer value
 2) Update the documentation to specify that floats/decimals are rounded to
 the nearest integer
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35821>
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/010701926ea4d93d-abc7c842-a57f-4269-8c5a-e18c0c095033-000000%40eu-central-1.amazonses.com.

Reply via email to