M.-A. Lemburg wrote: > You often have a need for controlled rounding when doing > financial calculations
You should NOT be using binary floats for money in the first place. > or in situations where you want to > compare two floats with a given accuracy, Pseudo-rounding to decimal places is not the right way to do that. The right way is to compare the difference to a tolerance. > e.g. to work > around rounding problems ;-) As Tim Peters has pointed out many times, you can't fix binary/decimal representation problems by rounding. There are always cases that give a different result than you would want. > Hmm, looks like a YAGNI to me, In all my programming so far I've found numerous uses for round-to-int, and exactly zero uses for round-binary-float-to-decimal- places. So from my point of view, the YAGNI applies to the *current* behavour of round()! -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com