ID: 46534 User updated by: alexanderpas at yahoo dot co dot uk Reported By: alexanderpas at yahoo dot co dot uk Status: Open Bug Type: Feature/Change Request Operating System: * PHP Version: 5.3.0alpha2 New Comment:
proper table... decimal value binary value difference 1000^1 = 10^3 1024^1 = 2^10 2.4% 1000^2 = 10^6 1024^2 = 2^20 4.9% 1000^3 = 10^9 1024^3 = 2^30 7.4% 1000^4 = 10^12 1024^4 = 2^40 10.0% 1000^5 = 10^15 1024^5 = 2^50 12.6% 1000^6 = 10^18 1024^6 = 2^60 15.3% 1000^7 = 10^21 1024^7 = 2^70 18.1% 1000^8 = 10^24 1024^8 = 2^80 20.9% Previous Comments: ------------------------------------------------------------------------ [2008-11-10 11:12:13] alexanderpas at yahoo dot co dot uk Description: ------------ PHP is handling kilo and other SI prefixes as multiples of 1024. The SI prefixes should only be used in the decimal sense: kilobyte and megabyte denote one thousand bytes and one million bytes respectively, while kibibyte and mebibyte denote 1024 bytes and 1,048,576 bytes respectively. This recommendation has been adopted by SI, IEEE, CIPM, NIST, ISO/IEC and some other leading national and international standards, which now state that the prefixes k, M and G should always refer to powers of ten, even in the context of information technology. (reference: ISO/IEC IEC 80000-13:2008 ) reduced timeline: 1998: IEC introduces unambigous prefixes for binary multiples (KiB, MiB, GiB etc.), reserving kB, MB, GB and so on for their decimal sense. 2005: IEC prefixes are adopted by the IEEE after a two-year trial period. 2008: NIST guidelines require use of IEC prefixes KiB, MiB ... (and not kB, MB) for binary byte multiples The names and symbols for the prefixes corresponding to 2 10 , 2 20 , 2 30 , 2 40 , 2 50 , and 2 60 are, respectively: kibi, Ki; mebi, Mi; gibi, Gi; tebi, Ti; pebi, Pi; and exbi, Ei. Thus, for example, one kibibyte would be written: 1 KiB = 2 10 B = 1024 B, where B denotes a byte. Although these prefixes are not part of the SI, they should be used in the field of information technology to avoid the incorrect usage of the SI prefixes. also remember this: decimal value binary value difference 10001 = 103 10241 = 210 2.4% 10002 = 106 10242 = 220 4.9% 10003 = 109 10243 = 230 7.4% 10004 = 1012 10244 = 240 10.0% 10005 = 1015 10245 = 250 12.6% 10006 = 1018 10246 = 260 15.3% 10007 = 1021 10247 = 270 18.1% 10008 = 1024 10248 = 280 20.9% also, this has a usability impact, since using the same wording with two different meanings is JUST PLAIN WRONG, and should end RIGHT NOW, Regular users don't know that the units have dual meanings, and we shouldn't continue confusing them in this way. also "man 7 units" on your linux-box ;) (please put in correct category!) Reproduce code: --------------- <?php ini_set('memory_limit', '32M'); for ($i=0; $i<=100000000; $i++) { $var.="a"; } Expected result: ---------------- Fatal error: Allowed memory size of 32000000 bytes exhausted (tried to allocate more bytes) in ./testcase.php on line 4 Actual result: -------------- Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292265 bytes) in ./testcase.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46534&edit=1