diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-11-04 20:17:55 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-04 20:17:55 -0600 |
commit | 44394699dea2534c5bb0c5e2e1759b066401def3 (patch) | |
tree | e0d6e01605cf2b01783fa0412147a73d2a99bfdd /doc/release | |
parent | 8b9195bb4e717eeaf74de5b1389f7b8ef7956350 (diff) | |
parent | a50f4725c8a0c2e8b71dd9c64c5fb103f5d6c987 (diff) | |
download | python-numpy-44394699dea2534c5bb0c5e2e1759b066401def3.tar.gz python-numpy-44394699dea2534c5bb0c5e2e1759b066401def3.tar.bz2 python-numpy-44394699dea2534c5bb0c5e2e1759b066401def3.zip |
Merge pull request #9941 from ahaldane/dragon4
ENH: Use Dragon4 algorithm to print floating values
Diffstat (limited to 'doc/release')
-rw-r--r-- | doc/release/1.14.0-notes.rst | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/release/1.14.0-notes.rst b/doc/release/1.14.0-notes.rst index 6feea0e76..c1e632c80 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 @@ -310,6 +312,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 ======= |