Re: Arbitrary precision arithmetic in django

2008-07-09 Thread Rob Hudson

On Jul 9, 8:07 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> Rob, I am never letting you do my financial programming for me. Float
> fields lose precision. Inexact. Approximate.

Heh.  Sorry.  I was misunderstanding "arbitrary".  Yeah, don't listen
to me, obviously.  :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Arbitrary precision arithmetic in django

2008-07-09 Thread Malcolm Tredinnick


On Wed, 2008-07-09 at 08:02 -0700, Rob Hudson wrote:
> FloatField?
> http://www.djangoproject.com/documentation/model-api/#floatfield

Rob, I am never letting you do my financial programming for me. Float
fields lose precision. Inexact. Approximate.

There is no Django field that is arbitrary precision, since database
fields that are fixed point require a precision when they're created (in
general). You'd have to create your own subfield class that did this for
you, I suspect, unless there's some trick I'm overlooking.
Alternatively, use an integer field and a precision field and then
convert them to a decimal when required (although, again, there's an
implicit maximum precision here, since there's limit on the size of the
integer field).

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Arbitrary precision arithmetic in django

2008-07-09 Thread Rob Hudson

FloatField?
http://www.djangoproject.com/documentation/model-api/#floatfield

On Jul 9, 4:02 am, shabda <[EMAIL PROTECTED]> wrote:
> I need to do some Financial calculations in an app in Django.
> models.DecimalField is fixed precision, while I need an arbitrary
> precision field. How can I do this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Arbitrary precision arithmetic in django

2008-07-09 Thread shabda

I need to do some Financial calculations in an app in Django.
models.DecimalField is fixed precision, while I need an arbitrary
precision field. How can I do this?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---