numbers with decimal points - question

Mark McEahern marklists at mceahern.com
Tue Jan 21 10:10:51 EST 2003


> price['Mon'][0] = 2.7
>
> when i print dict i see:
>
> {'Mon': {0: 2.7000000000000002}, 'Tue': {}}
>
> whats that? why no just 2.7?
> Any help and suggestions are very appreciated.

Read the Python FAQ regarding binary representation of floating point
numbers.

// m

-






More information about the Python-list mailing list