> 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.

>

> Cheers

>

> Tom

>

> >>> 1.0 * 10000000000000000000000000000

>

> 9.9999999999999996e+27

Actually, 1.0 is NOT an approximation to 1. It is precisely 1. All

integral values up to 2^53-1 can be represented exactly. So can many

rational fractions (roughly, those in which the denominator is a power

of two and the numerator and denominator don't differ by a really big

ratio).

The reason the above example fails isn't the 1.0, it's because the

second number (10^28) is bigger than 2^53, so IT can't be represented

exactly.

--

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+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

## No comments:

## Post a Comment