Re: DecimalField Problem
On Wed, Jan 8, 2014 at 1:44 PM, Erik Cederstrand <erik+lists@cederstrand.dk> wrote:
-- Den 08/01/2014 kl. 16.18 skrev Timothy W. Cook <tim@mlhim.org>:
> So, why doesn't it just store a zero?Underneath a DecimalField there is a Python float type, and some equivalent float type in your database. Float values are an approximation, so 0.000000000000 and 0 are not guaranteed to be equal. See http://stackoverflow.com/questions/2986150/python-floating-number
But one would think that if Django calls it a decimal field, it would convert the float to decimal.
I suppose I'll do that before writing it out to the file (an XML schema) so it really isn't a big deal, just surprising.
BTW: it is stored in PostgreSQL as 0.0000000000 as a numeric.
> In reality I need to allow the range of, positive infinity to negative infinity. But this doesn't seem possible. Is it?It's not physically or computationally possible. How will you store an infinite number of digits on a hard drive of finite size? :-)
Yeah, that was supposed to be sarcastic but it didn't come across well. :-)
--Tim
MLHIM VIP Signup: http://goo.gl/22B0U
============================================
Timothy Cook, MSc +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WGtzHnEf-CJ8hzXXsR2k9dSmz7OZUhc00kUFnA2jy6eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home