How Do I Convert Bytes to Kilobytes, Megabytes, and Gigabytes?Primary Software: Primary Software Version: 7.1 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: Some functions, such as Volume Info return information in bytes. How do I properly convert bytes to kilobytes, megabytes, and gigabytes?Solution: There can be some confusion as to how many bytes a kilobyte actually represents. When referring to memory a kilobyte is not 1,000 bytes, but rather 1024 bytes (which is 2^10 bytes). This is because memory must increase in binary (or base two) increments. So to convert from bytes to kilobytes you would divide the number of bytes by 1024. See the table below for other prefixes.
Note: kilo was borrowed from the base 10 system to represent 1024 in the base 2 system because where was not a prefix for it. Since that convention was established, there have arisen several alternate conventions and terms. However, these have not been accepted into the mainstream vocabulary. One convention is instead of kilo, mega, giga, and tera; to use kibi, mebi, gibi, and tebi as the prefixes for the binary system (meaning the powers of 2 - i.e. 1 kibibyte = 1024 bytes and 1 kilobyte = 1000 bytes). Another convention is to use a lower case letter for the prefix in the abbreviation to indicate that a power of 10 was used (i.e. 1 KB = 1024 bytes while 1 kB = 1000 bytes). It is also common for communication methods to state specification on a per bit basis instead of bytes and to use the base 10 use of the prefixes. Often times bits are abbreviated with a lower case 'b' and bytes with a capital 'B' (i.e. 1 Kbps is 1000 bits per second and 1 KB/s is 1024 bytes per second). Related Links: KnowledgeBase 16I374PV: What is the Precision Difference Between float and double Datatypes? KnowledgeBase 2ASACHQO: What Representation Does LabVIEW Use for Various Data Types? Attachments:
Report Date: 05/06/2003 Last Updated: 04/07/2016 Document ID: 2X5A8EQS |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
