Skip to content
Search

Data Type

lastmod 2024-06-03created 2014-03-1711 edits

Detailed classification of data types

A data type, in computer science and programming languages, is a classification that identifies various kinds of data such as real numbers, integers, and Booleans, and that further determines the possible values for that type, the operations that can be performed on that type, the meaning of the data, and the way values of that type are stored.

Overview

Data types describe the representation, interpretation, and structure of values and objects stored in computer memory, and are used to interpret data within a type system. Various type systems guarantee different degrees of type safety, and use type information to check the validity of computer programs that access and use data. A data type can be defined as "a property of a program that can be determined without executing the program."

Almost all programming languages explicitly include the notion of data types, though different languages may use different terminology. They commonly include the following:

  • Integer
  • Boolean
  • Character
  • Floating-point number
  • Alphanumeric string

Data types

Data Types

Uninterpreted

Bit, Byte, Trit, Tryte, Word

Numeric

Integer (signedness), Fixed-point, Floating-point, Rational, Complex, Bignum, Interval, Decimal

Text

Character, String (null-terminated)

Pointer

Address (physical, virtual), Reference

Composite

Algebraic data type (generalized), Array, Associative array, Class, List, Object (Metaobject), Option type, Product, Record, Set, Union (tagged)

Other

Boolean, Bottom type, Collection, Enumerated type, Exception, Function type, Opaque data type, Recursive data type, Semaphore, Stream, Top type, Type class, Unit type, Void

Related topics

Type system, Abstract data type, Data structure, Protocol (Interface), Kind (Metaclass), Primitive data type, Subtyping, Generic, Type constructor, Type conversion, Parametric polymorphism

Bit

A bit (binary digit) is the unit of information in computer science and information theory, also called dugap (Korean for "two values"). It is the smallest unit of information storage used in these fields, and research is currently progressing on the qubit, which may replace it. A single bit can have a value of 0 or 1, each representing true, false, or mutually exclusive states. A byte is a group of several bits; originally its size was not clearly defined, but today 8 bits, usually one octet, make up 1 byte. 4 bits are called a nibble, and two bytes refer to a word in some telecommunications devices. Terms with SI prefixes such as kilobit (kb), megabit (Mb), and gigabit (Gb) are also commonly used.

Multiples of bit

Decimal

Value

SI

1000

103

kbit

kilobit

10002

106

Mbit

megabit

10003

109

Gbit

gigabit

10004

1012

Tbit

terabit

10005

1015

Pbit

petabit

10006

1018

Ebit

exabit

10007

1021

Zbit

zettabit

10008

1024

Ybit

yottabit

Binary

Value

IEC

JEDEC

1024

210

Kibit

kibibit

Kbit

kilobit

10242

220

Mibit

mebibit

Mbit

megabit

10243

230

Gibit

gibibit

Gbit

gigabit

10244

240

Tibit

tebibit

-

10245

250

Pibit

pebibit

-

10246

260

Eibit

exbibit

-

10247

270

Zibit

zebibit

-

10248

280

Yibit

yobibit

-

Byte

A byte is commonly used as a unit for the size of computer memory, and in many programming languages it is also a data type belonging to the integer types. The practical meaning of a byte is that it can represent a single ASCII character. Therefore, even today, when several bytes are used as one word, it is used as the unit of memory addressing in most computer hardware.

There are several definitions of a byte; they have similar meanings, but mixing them can cause confusion.

  1. A contiguous sequence of a fixed number of bits. The "fixed number" is not always set, but these days it is common to effectively treat 1 byte as 8 bits.
  2. A contiguous sequence of bits corresponding to the smallest addressable unit within a word of a binary computer. For example, CDC 6000 series mainframes split a 60-bit floating-point real number into ten 6-bit bytes, which made it easy to output results to punched cards that could represent only uppercase Latin letters and digits. Also, because CDC used 12-bit I/O, 12 bits were sometimes called 1 byte. This definition also mostly refers to 8 bits these days, but historically there have been 6-bit, 7-bit, 9-bit, and other bytes.
  3. The smallest meaningful contiguous sequence of bits in a serial data stream (for example, a modem). This may include start bits, stop bits, parity bits, and so on; for example, when storing 7-bit ASCII code, a byte can be anywhere from a minimum of 7 bits to a maximum of 12 bits.
  4. A data type in some programming languages. For example, in C a byte is defined as a unit large enough to hold the characters used in the execution environment (C standard section 3.5), and the char data type holding one byte must be at least 8 bits (section 5.2.4.2.1), whether signed or unsigned. Java's byte data type is always signed and defined as 8 bits.

When the number of bits in a byte matters, a fixed-size unit such as the octet is often used, especially in computer networks and telecommunications. Also, in French, octet is sometimes used to mean byte.

Word

A word is the unit of data that can be moved from storage into a register in a single operation.

Units

SI Prefix

10n

Prefix

Symbol

Multiple

Decimal

10<sup>24

yotta

Y

septillion

1 000 000 000 000 000 000 000 000

1021

zetta

Z

sextillion

1 000 000 000 000 000 000 000

1018

exa

E

quintillion

1 000 000 000 000 000 000

1015

peta

P

quadrillion

1 000 000 000 000 000

1012

tera

T

trillion

1 000 000 000 000

109

giga

G

billion

1 000 000 000

106

mega

M

million

1 000 000

103

kilo

k

thousand

1 000

102

hecto

h

hundred

100

101

deca

da

ten

10

100

one

1

10−1

deci

d

tenth

0.1

10−2

centi

c

hundredth

0.01

10−3

milli

m

thousandth

0.001

10−6

micro

µ

millionth

0.000 001

10−9

nano

n

billionth

0.000 000 001

10−12

pico

p

trillionth

0.000 000 000 001

10−15

femto

f

quadrillionth

0.000 000 000 000 001

10−18

atto

a

quintillionth

0.000 000 000 000 000 001

10−21

zepto

z

sextillionth

0.000 000 000 000 000 000 001

10−24

yocto

y

septillionth

0.000 000 000 000 000 000 000 001

Favorite site

References


  1. Ms-dtyp_windows_data_types.pdf ↩