Reimplementation of formatSize to return a more meaningful value (fixes #4198).

This commit is contained in:
A. S. Budden
2016-06-01 12:56:01 +01:00
parent 24a56a2cb6
commit d855ad7045
2 changed files with 95 additions and 23 deletions

View File

@@ -50,6 +50,11 @@ Changes affecting backwards compatibility
than changing the operation for even and odd numbers.
- The ``round`` function now accepts a ``places`` argument to round to a
given number of places (e.g. round 4.35 to 4.4 if ``places`` is 1).
- In ``strutils.nim``, ``formatSize`` now returns a number representing the
size in conventional decimal format (e.g. 2.234GB meaning 2.234 GB rather
than meaning 2.285 GB as in the previous implementation). By default it
also uses IEC prefixes (KiB, MiB) etc and optionally uses colloquial names
(kB, MB etc) and the (SI-preferred) space.
Library Additions
@@ -63,6 +68,8 @@ Library Additions
versions are for ``char`` and ``set[char]``.
- Added ``splitDecimal`` to ``math.nim`` to split a floating point value
into an integer part and a floating part (in the range -1<x<1).
- Added ``trim`` argument to ``formatFloat`` in ``strutils.nim`` to trim
trailing zeros.
Compiler Additions