Tim Peters wrote: > Please read the whole thread. Maybe you did, but you said nothing > here that indicated you had. The issues aren't about tiny integers > that happen to be in float format, where the result is exactly > representable as a float too. Those don't create problems for any > definition of mod. But even non-tiny exact integers can.
I did read the whole thread, and I saw your -1%1e100 example. Mixing floating-point numbers of very different magnitude can get you in trouble - e.g. -1+1e100==1e100. I don't think -1%1e100 is all that worse. > > It's only Decimal.__mod__ that's inconsistent. float.__mod__ has the > > usual floating-point inaccuracies, but then with float that goes with > > the territory. > > No. Decimal.__mod_ always returns the mathematically exact result. I meant inconsistent with integers. People are familiar with the semantics of % on integers, because they use it all the time. % on float is a natural extension of that and hence unsurprising. % on Decimal is exact and correct, but surprising all the same. regards, Anders _______________________________________________ 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