[Python-ideas] statistics module in Python3.4
Steven D'Aprano
steve at pearwood.info
Fri Jan 31 09:18:20 CET 2014
On Fri, Jan 31, 2014 at 02:56:39PM +0900, Stephen J. Turnbull wrote:
> Steven D'Aprano writes:
>
> > Floats violate several of the fundamental rules of mathematics,
> > e.g. addition is not commutative:
>
> AFAIK it is.
>
> > py> 1e19 + (-1e19 + 0.1) == (1e19 + -1e19) + 0.1
> > False
>
> This is a failure of associativity, not commutativity.
Oops, you are correct. I got them mixed up.
http://en.wikipedia.org/wiki/Associativity
However, commutativity of addition can violated by Python numeric types,
although not floats alone. E.g. the example I gave earlier of two int
subclasses.
--
Steven
More information about the Python-ideas
mailing list