christian schulze wrote: > #1: >>>> 2.0 * e * sqrt(3.0) - 2.0 * e > 3.9798408154464964 > > #2: >>>> 2.0 * e * (sqrt(3.0) -1.0) > 3.979840815446496 > > I was wondering what exactly is failing here. The math module? Python, > or the IEEE specifications?
Limited-precision calculation, computer floating-point for example, will do this. Intermediate results get rounded off in different ways on different paths through the "same" calculation. The whole truth for this will be revealed in a Numerical Analysis textbook, e.g. James B. Scarbourough, _Numerical Mathematical Analysis_, Mel. -- http://mail.python.org/mailman/listinfo/python-list