summaryrefslogtreecommitdiff
path: root/AK/NumberFormat.h
AgeCommit message (Collapse)Author
2021-04-29Everywhere: Use "the SerenityOS developers." in copyright headersLinus Groh
We had some inconsistencies before: - Sometimes "The", sometimes "the" - Sometimes trailing ".", sometimes no trailing "." I picked the most common one (lowecase "the", trailing ".") and applied it to all copyright headers. By using the exact same string everywhere we can ensure nothing gets missed during a global search (and replace), and that these inconsistencies are not spread any further (as copyright headers are commonly copied to new files).
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-25AK: Add longer human readable size to string helper functionDavid Isaksson
Wraps the existing AK::human_readable_size function but will always display the bytes in the base unit as well as the shorter string with one decimal. E.g. "14 KiB (14396 bytes)".
2021-03-17AK: Implement terabytes, petabytes, exabytesJean-Baptiste Boric
2021-02-08Everywhere: Remove unnecessary headers 3/4Ben Wiederhake
Arbitrarily split up to make git bisect easier. These unnecessary #include's were found by combining an automated tool (which determined likely candidates) and some brain power (which decided whether the #include is also semantically superfluous).
2020-10-08AK: Use new format functions.asynts
2020-08-23AK: Fix human_readable_size corner casesBen Wiederhake
In particular: consistent rounding and extreme values. Before, rounding was something like 'away from 0.999...', which led to surprising corner cases in which the value was rounded up. Now, rounding is always 'down'. This even works for 0xffffffff, and also for 0xffffffffffffffffULL on 64-bit.
2020-08-23Meta: Fix wrong 'using namespace X' usagesBen Wiederhake
Apart from causing All AK:: and Crypto:: symbols being suddenly visible even though they might not be supposed to be, the style guide also says this is wrong: https://github.com/SerenityOS/serenity/blob/master/Documentation/CodingStyle.md#using-statements
2020-08-16AK: Use IEC prefixes in human_readable_formatNico Weber
Windows uses "KB", "MB", "GB" as powers of two. macOS uses "kB", "MB", "GB" as powers of ten. "k", "M", "G" are standard SI prefixes that normally refer to powers of ten. The IEC introduced "KiB", "MiB", "GiB" to unambiguously refer to powers of two. It admittedly hasn't caught on that much, but it does have the advantage that it's unabigious what it means. So let's use it for user-visible sizes in SerenityOS. (Linux does all of the above in different places, depending on app and toolkit.)
2020-08-16Everywhere: Consolidate human_readable_size() implementationsNico Weber
Let's use the one in AK/NumberFormat.h everywhere. It has slightly different behavior than some of the copies this removes, but it's probably nice to have uniform human readable size outputs across the system.
2020-08-16AK: Rename KB, MB, GB to KiB, MiB, GiBNico Weber
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9". The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30". Let's use the correct name, at least in code. Only changes the name of the constants, no other behavior change.
2020-05-03AK+FileManager: Move out human_readable_size to AK::NumberFormatAnotherTest