History log of /freebsd-10.1-release/lib/libutil/humanize_number.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 256130 07-Oct-2013 jmg

don't assert on bad args, instead return an error..

Since so many programs don't check return value, always NUL terminate
the buf...

fix rounding when using base 1024 (the bug that started it all)...

add a set of test cases so we can make sure that things don't break
in the future...

Thanks to Clifton Royston for testing and the test program...

Approved by: re (hrs, glebius)
MFC after: 1 week


# 240391 12-Sep-2012 bapt

Fix IEC / SI binary prefixes (Ki, Mi, Gi, etc) production by humanize_number(3)

PR: bin/171487
Submitted by: matthew
MFC after: 1 week


# 220582 12-Apr-2011 delphij

Add support for IEE/IEC (and now also SI) power of two notions of
prefixes (Ki, Mi, Gi...) for humanize_number(3).

Note that applications has to pass HN_IEC_PREFIXES to use this
feature for backward compatibility reasons.

Reviewed by: arundel
MFC after: 2 weeks


# 219939 23-Mar-2011 delphij

humanize_number(3) multiply the input number by 100, which could cause an
integer overflow when the input is very large (for example, 100 Pi would
become about 10 Ei which exceeded signed int64_t).

Solve this issue by splitting the division into two parts and avoid the
multiplication.

PR: bin/146205
Reviewed by: arundel
MFC after: 1 month


# 194794 23-Jun-2009 delphij

Merge NetBSD revision 1.14: humanize_number.c is now 2-clause BSD licensed.
(humanize_number.3 intentionally hold back until I make sure why we didn't
merged dehumanize_number(3)).

Obtained from: NetBSD


# 176954 08-Mar-2008 antoine

Merge changes from NetBSD on humanize_number.c, 1.8 -> 1.13
Significant changes:
- rev. 1.11: Use PRId64 instead of a cast to long long and %lld to print
an int64_t.
- rev. 1.12: Fix a bug that humanize_number() produces "1000" where it
should be "1.0G" or "1.0M". The bug reported by Greg Troxel.

PR: 118461
PR: 102694
Approved by: rwatson (mentor)
Obtained from: NetBSD
MFC after: 1 month


# 135792 25-Sep-2004 pjd

Take the lastest fixes from NetBSD.

Obtained from: NetBSD


# 129677 24-May-2004 pjd

Add humanize_number(3) to libutil for formating numbers into a human
readable form.

Obtained from: NetBSD