Scalar Data Types: Booleans

The Boolean data type is a data type, having two values(usually denoted true or false), intended to represent the truth values of logic and Boolean algebra.

Specification: In Pascal and Ada, the Boolean data type is considered simply a language - defined enumeration, viz;

type Boolean=(false, true);

Which both defines the names true and false for the values of the types and define ordering false<true

Common Operations in boolean are

and : Boolean*Boolean->Boolean(conjunction)

or : Boolean*Boolean->Boolean(inclusive disjunction )

not : Boolean ->Boolean(negative or complement)

Implementation of boolean data type:

Single bit of storage is provided, no descriptor designated the data type is needed. Because single bit may not be separately addressable in memory which often takes a byte or word to represent it if extended. Then the value true and false might be represented in two ways within the storage unit:

• 1) a particular bit is used for the value(often the sign bit of the number representation), with '0= false', '1=true', and the rest of the byte or word ignored, or

• 2) A zero value in the entire storage unit represent False, and any other non zero value represents true

boolean


Facebook Likes

Youtube