On Tue, Jun 28, 2011 at 2:37 PM, Tom Evans <tevans...@googlemail.com> wrote:

> On Tue, Jun 28, 2011 at 2:23 PM, Cal Leeming [Simplicity Media Ltd]
> <cal.leem...@simplicitymedialtd.co.uk> wrote:
> > I'm wondering if it's better practise to always cast a number as a
> > float/decimal, rather than an int.
> > Any thoughts guys?
> > Cal
> >
>
> Damn, this was the bit I meant to comment upon - hard and fast rules
> are dangerous. Integral types are distinctly different to floating
> point types, and you should be aware of which one you are using and
> why. You definitely should not be using floats when you require
> integral mathematics, or reliable accounting since 1.0 is only an
> approximation to 1.
>

Yeah I have come up against horrible problems before when forcibly
re-casting all int's to float's.. (especially when it's in the monetary
sense). I had assumed that it would be a on a "per case" basis, but just
wanted to make sure.


>
> Cheers
>
> Tom
>
>
> >>> 1.0 * 10000000000000000000000000000
> 9.9999999999999996e+27
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to