Yes, for more details, see
here<http://docs.python.org/tutorial/floatingpoint.html>[1]
and here <http://docs.python.org/library/decimal.html>[2].
[1] http://docs.python.org/tutorial/floatingpoint.html
[2] http://docs.python.org/library/decimal.html
On Friday, January 21, 2011 4:43:52 PM UTC-5, DenesL wrote:
>
> Nothing wrong, it is a decimal to binary conversion error.
> To get accurate results you have to use Decimal type.
>
> from decimal import *
> test1 = Decimal('250.90')
> ...
>
>
> On Jan 21, 4:32 pm, Kenneth Lundström <[email protected]>
> wrote:
> > test1 = 250.90
> > test2 = 47.90
> > test3 = 99.90
> >
> > test4 = test1 + test2 + test3
> >
> > test5 = 398.70
> >
> > test6 = test5 - test4
> >
> > return test6
> >
> > This returns -5.68434188608e-14 not 0 as you would expect, or?
> >
> > Kenneth