inverse of a matrix with Fraction entries
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Nov 28 01:56:48 CET 2010
On Sat, 27 Nov 2010 15:44:38 -0800, casevh wrote:
> I think most users are expecting infinite precision when they use
> rationals. Trying to explain limited precision rational arithmetic might
> be interesting.
Most users are expecting infinite precision decimals when they use
floats, and get surprised and dismayed by things like these:
>>> sum([0.1]*10) == 1
False
>>> 0.1 + 1e50 + 0.1 - 1e50
0.0
>>> a, b, c = 0.1, 0.7, 0.3
>>> a*b + a*c == a*(b+c)
False
Trying to explain arithmetic on computers is interesting, no matter what
you use.
--
Steven
More information about the Python-list
mailing list