Coercion of Data Types - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Coercion of Data Types.
Encyclopedia Article

Coercion of Data Types - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Coercion of Data Types.
This section contains 287 words
(approx. 1 page at 300 words per page)

Coercion of data types is a technique for converting data from one type to another; its purpose is to make the data compatible with the code executing a command. Data-type coercion is an action usually taken "behind the scenes" by a computer without the user being aware of it. An example of coercion of data types is the conversion from integer (e.g., 2, 79, 563) to floating point (e.g., 2.00, 7.9, .563) or vice versa. Coercion can involve changes as simple as truncation or rounding. For instance, if input is represented in floating point notation but the output only needs an integer value, then the result will be converted from floating point to integer notation; for example, from "2.00" to "2."

A data type is a special internal code used inside a computer to keep track of the different types of data that it processes. A particular data type is a set of data that specifies (1) the possible range of values of the set, (2) the operations that can be performed on the values, and (3) the way in which the values are stored in computer memory. Data types often include such notations as real (e.g., whole and fractional numbers), integer (e.g., whole numbers), floating point (e.g., a number with a decimal point), character (e.g., readable text), Boolean (e.g., the binary numbers 0 and 1), and pointer (e.g., any mouse-controlled symbol).

Usually, a limited number of data types come built into a computer programming language. Whenever data types are specified, conversion among them is generally allowed. With object-oriented programming a programmer can create new data types to meet application needs. Conversion among the new and old (built-in) data types is also usually allowed.

This section contains 287 words
(approx. 1 page at 300 words per page)
Copyrights
Gale
Coercion of Data Types from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.