summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2017-11-04 10:36:55 -0400
committerAllan Haldane <allan.haldane@gmail.com>2017-11-04 19:16:39 -0400
commita50f4725c8a0c2e8b71dd9c64c5fb103f5d6c987 (patch)
tree64e1426ced8942e8ff4368ff8d94050eb7530127
parent9ab9e8bce1a79f8a3e53862289c58b73847c3f07 (diff)
downloadnumpy-a50f4725c8a0c2e8b71dd9c64c5fb103f5d6c987.tar.gz
DOC: update documentation for dragon4
-rw-r--r--doc/release/1.14.0-notes.rst24
-rw-r--r--doc/source/reference/routines.io.rst2
2 files changed, 26 insertions, 0 deletions
diff --git a/doc/release/1.14.0-notes.rst b/doc/release/1.14.0-notes.rst
index 0aeeadd40..c96e7444f 100644
--- a/doc/release/1.14.0-notes.rst
+++ b/doc/release/1.14.0-notes.rst
@@ -16,6 +16,8 @@ New functions
* ``parametrize``: decorator added to numpy.testing
* ``chebinterpolate``: Interpolate function at Chebyshev points.
+* ``format_float_positional`` and ``format_float_scientific`` : format
+ floating-point scalars unambiguously with control of rounding and padding.
Deprecations
@@ -306,6 +308,28 @@ now supported for these arrays:
* `arr.resize(...)`
* `pickle.dumps(arr)`
+Float printing now uses "dragon4" algorithm for shortest decimal representation
+-------------------------------------------------------------------------------
+All numpy floating-point types (16, 32, 64 and 128 bit) can now be printed to
+give shortest decimal representation of the number, which uniquely identifies
+the value from others of the same type.
+
+New functions ``np.format_float_scientific`` and ``np.format_float_positional``
+are provided to generate these decimal representations, with control over
+rounding, trimming and padding.
+
+The ``str`` and ``repr`` of floating-point scalars now shows the shortest
+unique decimal representation. This means there will be a different number of
+digits compared to numpy 1.13, for instance float64 and float128 will be longer
+and float16 will be shorter.
+
+For arrays of floating-point type, a new formatting option ``floatmode`` has
+been added to ``np.set_printoptions`` and ``np.array2string``, which gives
+control over uniqueness and rounding of printed elements in arrays. The new
+default is ``floatmode='maxprec'`` with ``precision=8``, which will print at most
+8 fractional digits, or fewer if an element can be uniquely represented with
+fewer.
+
Changes
=======
diff --git a/doc/source/reference/routines.io.rst b/doc/source/reference/routines.io.rst
index 6747f60bd..00cafebc2 100644
--- a/doc/source/reference/routines.io.rst
+++ b/doc/source/reference/routines.io.rst
@@ -45,6 +45,8 @@ String formatting
array2string
array_repr
array_str
+ format_float_positional
+ format_float_scientific
Memory mapping files
--------------------