array precision

Hugo Martires hmartires at cultalg.pt
Wed Feb 6 06:32:18 EST 2002


but i don´t need all the numbers, i only need 0.6


"Jason Orendorff" <jason at jorendorff.com> wrote in message
news:mailman.1012956250.23108.python-list at python.org...
> Hugo Martires writes:
> > suposing that n=10 we get: myArray[0] = 0.600000023 ("something
> > like this")
> >
> > but if i do: myArray[i] + (1.0/n) it give's me 0.6
> >
> > what's the problem of the array, and how can i solve this ?
>
> It's only half of the normal precision.  From the documentation:
>
>     The following type codes are defined:
>         Type code   C Type             Minimum size in bytes
>         'f'         floating point     4
>         'd'         floating point     8
>
> Try using 'd' instead of 'f'.
>
> ## Jason Orendorff    http://www.jorendorff.com/
>
>





More information about the Python-list mailing list