Dnia czwartek, 7 września 2006 14:37, Andrei napisał: > > get me into trouble with the flakiness of float(n)? In testing I > > didn't find any problems, but .. > > Nah. Float accuracy is only a problem if you need around lots of > significant digits (16 or so).
I wouldn't bet. Such a simple thing as 0.1 can't be represented correctly on Float... That's what 'decimal' is for. See that: >>> 0.1 + 0.1 + 0.1 - 0.3 5.5511151231257827e-17 >>> >>> from decimal import Decimal >>> Decimal("0.1")+ Decimal("0.1")+ Decimal("0.1")-Decimal("0.3") Decimal("0.0") >>> For more see: http://docs.python.org/lib/module-decimal.html -- Pawel Kraszewski http://www.kraszewscy.net _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor