Determinant of Large Matrix

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Jun 7 06:03:05 EDT 2007


James Stroud wrote:

> If I run it again on 10 (or 1000) the set is basically homogenous
> but now of different values (terribly confusing):
> 
> set([12048175104.00001, 12048175104.000015, 12048175104.000046,
> 12048175103.999994, 12048175104.000023, 12048175103.999981,
> 12048175103.999998, 12048175103.99999])

As you seem to have overread it: Note that Python only prints those
numbers with full "bogus" precision since you let it display them
using repr() (it's used in lists by default for display). If you
use str() explicitly, Python applies rounding:
 
>>> A
[12048175104.00001, 12048175104.000015, 12048175104.000046,
12048175103.999994, 12048175104.000023, 12048175103.999981,
12048175103.999994, 12048175104.000023, 12048175103.999981,
12048175103.999998, 12048175103.99999]
>>> [repr(i) for i in A]
['12048175104.00001', '12048175104.000015', '12048175104.000046',
'12048175103.999994', '12048175104.000023', '12048175103.999981',
'12048175103.999994', '12048175104.000023', '12048175103.999981',
'12048175103.999998', '12048175103.99999']
>>> [str(i) for i in A]
['12048175104.0', '12048175104.0', '12048175104.0', '12048175104.0',
'12048175104.0', '12048175104.0', '12048175104.0', '12048175104.0',
'12048175104.0', '12048175104.0', '12048175104.0']
>>> 

Regards,


Björn

-- 
BOFH excuse #83:

Support staff hung over, send aspirin and come back LATER.




More information about the Python-list mailing list