[MATRIX-SIG] Printing BUG?

Konrad Hinsen hinsen@ibs.ibs.fr
Sat, 4 Oct 1997 08:36:53 +0200


>   File "/usr/local/lib/python1.4/NumPy/ArrayPrinter.py", line 118, in
> _floatFormat
>     max_str_len = len(str(int(max_val))) + precision + 2
> OverflowError: float too large to convert
> ------------------------------------------------------
> 
> I really don't know much about the printing code, but it doesn't seem
> that 1.49e+11 should be too large of a number to be converted (to a
> string, I assume).  And besides, why does it work when I print x, and
> not when I print x[0]?

What fails is the conversion to an integer, done do determine the
length of the mantissa. That ought to be changed to something more
tolerant of large numbers, of course. But as a quick fix, change
line 101 of ArrayPrinter.py:

		if max_val >= 1.e12:

Reducing the limit will cause big numbers to be printed in exponential
format rather than crashing.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________