[NumPy-Tickets] [NumPy] #1592: Formatting with arrayprint goes wrong
NumPy Trac
numpy-tickets@scipy....
Wed Aug 25 07:25:18 CDT 2010
#1592: Formatting with arrayprint goes wrong
------------------------+---------------------------------------------------
Reporter: gaubi | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: numpy.core | Version: 1.4.0rc1
Keywords: formatting |
------------------------+---------------------------------------------------
Comment(by rgommers):
Okay that makes sense. Guess I'm so used to this behavior it doesn't
register as strange anymore. The offending lines are in
core/arrayprint.py, lines 409-413:
{{{
if max_val >= 1.e8:
self.exp_format = True
if not self.suppress_small and (min_val < 0.0001
or max_val/min_val > 1000.):
self.exp_format = True
}}}
This is a little arbitrary. As a result:
{{{
>>> print(np.array([1e-3, 1e-4]))
[ 0.001 0. ]
>>> print(np.array([1e-1, 1e-4]))
[ 0.1 0. ]
>>> print(np.array([1e0, 1e-4]))
[ 1.000e+00 1.000e-04]
}}}
There was a similar request here,
http://thread.gmane.org/gmane.comp.python.numeric.general/22728, to create
an option to force printing in scientific notation. Engineering notation
(exponent is multiple of 3) would also be useful.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1592#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list