Biostatistics
Biostatistics
(SESSION:-2024-2025)
DEPARTMENT OF BIOTECHNOLOGY
SCHOOL OF LIFE SCIENCES
DR. BHIMRAO AMBEDKAR UNIVERSITY, AGRA
1|Page
Table of Contents
Introduction ............................................................................................................................................ 4
• Overview of Computer Codes ................................................................................................ 4
• Importance in computing and data representation .............................................................. 4
Binary Coded Decimal (BCD) .................................................................................................................. 4
• Definition and explanation .................................................................................................... 4
• Structure of BCD .................................................................................................................... 5
o 4-bit Representation .......................................................................................................... 5
o Weighted Coding (8421) .................................................................................................... 5
• Examples of BCD Conversion ................................................................................................. 5
o Decimal to BCD Conversion ............................................................................................... 5
o BCD to Decimal Conversion ............................................................................................... 6
• Applications of BCD ................................................................................................................ 6
o Use in digital Systems ........................................................................................................ 6
o Advantages and Disadvantages ......................................................................................... 6
Extended Binary Coded Decimal Interchange Code (EBCDIC) .............................................................. 7
2|Page
Comparison of BCD, EBCDIC, Zoned, and Packed Decimal Codes ...................................................... 11
Conclusion ............................................................................................................................................ 12
3|Page
Introduction
Overview of Computer Codes
Computer codes are fundamental to the operation of modern computing systems. They serve
as a structured method for instructing computers on how to perform specific tasks and
operations. Essentially, a code is a set of instructions written in a programming language that
can be executed by a computer. These instructions can range from simple arithmetic
calculations to complex algorithms that facilitate data processing and user interactions. The
various types of computer codes include source code, machine code, and various encoding
schemes that represent data in a format that computers can understand and manipulate.
Computer codes play a critical role in software development, as they are the building blocks
of all applications, websites, and systems that we interact with daily. By translating human
logic into a format that machines can process, coding enables developers to create software
that meets specific user needs and solves real-world problems. The process of coding
involves not only writing the instructions but also debugging and refining them to ensure
optimal performance and functionality.
4|Page
Structure of BCD Decimal BCD
0 0000
o 4-bit Representation
1 0001
In BCD, each decimal digit (0-9) is represented using 2 0010
a four-bit binary code. The BCD representation for the 3 0011
digits 0 through 9 is given in Table. 4 0100
5 0101
This structure allows for the representation of any 6 0110
decimal number by concatenating the BCD codes of 7 0111
its individual digits. 8 1000
9 1001
5|Page
o BCD to Decimal Conversion
To convert from BCD back to decimal, each four-bit group is interpreted as its corresponding
decimal digit. For example:
BCD Number: 0010 0111
• 0010 corresponds to '2'
• 0111 corresponds to '7'
• Decimal Representation: 27
BCD Number: 1001 0100 0110
• 1001 corresponds to '9'
• 0100 corresponds to '4'
• 0110 corresponds to '6'
• Decimal Representation: 946
Applications of BCD
o Use in Digital Systems
BCD is widely used in digital systems where precise decimal representation is necessary.
Common applications include:
• Digital Clocks: Where time needs to be displayed accurately.
• Calculators: That require exact decimal calculations without rounding errors.
• Financial Applications: Where currency values must be represented accurately to
avoid discrepancies due to floating-point arithmetic.
6|Page
Extended Binary Coded Decimal Interchange Code
(EBCDIC)
Definition and Purpose
Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8-bit character encoding
system developed by IBM primarily for use in its mainframe and midrange computer
systems. EBCDIC was introduced in the early 1960s as an enhancement over earlier coding
systems, such as the 6-bit binary-coded decimal (BCD) used with punched cards. The
purpose of EBCDIC is to represent alphanumeric characters, control characters, and special
symbols in a format that can be processed by computers. With the ability to encode 256
different characters, EBCDIC supports a wide range of applications in data processing,
particularly in business and financial environments.
Structure of EBCDIC
o 8-bit Representation
EBCDIC utilizes an 8-bit binary coding scheme, allowing for a total of 28=256 possible
character representations. This structure enables EBCDIC to encompass a broader range of
characters compared to the 7-bit ASCII (American Standard Code for Information
Interchange), which can only represent 128 characters. The additional bits in EBCDIC allow
for the inclusion of more symbols and control codes, making it suitable for various
applications requiring extensive character sets.
7|Page
• Character Range: ASCII can represent 128 characters using a 7-bit code, while
EBCDIC can represent up to 256 characters.
• Encoding Scheme: ASCII uses a sequential binary assignment for its characters,
whereas EBCDIC employs a non-sequential approach.
• Usage Context: ASCII is widely used across modern computing systems and the
internet due to its compatibility with various platforms. In contrast, EBCDIC remains
prevalent primarily in IBM mainframes and legacy systems.
Applications of EBCDIC
EBCDIC's primary applications are found in environments where IBM mainframe systems
are utilized. Some notable applications include:
• Business Data Processing: EBCDIC is commonly used in financial institutions for
processing transactions, as it allows for efficient handling of alphanumeric data.
• Legacy Systems: Many older systems that rely on punched cards or older IBM
hardware continue to use EBCDIC due to historical compatibility.
• Data Storage: Its compact encoding helps maximize storage capacity when dealing
with large volumes of data on legacy mainframe hardware.
8|Page
Structure of Zoned Decimal Numbers
o Zone Bits and Digit Bits
In zoned decimal representation, each byte is divided into two segments:
Zone Bits: The first four bits (or the high nibble) are used as the zone bits. These bits
typically indicate the sign of the number or serve as a placeholder. For example:
o The zone bit 'F' (1111 in binary) is commonly used for positive digits.
o The zone bit 'B' (1011 in binary) indicates a negative digit.
Digit Bits: The last four bits (or the low nibble) represent the actual decimal digit. Each digit
from 0 to 9 is encoded in its corresponding four-bit binary form:
o For instance, the digit '5' is represented as 0101.
A complete zoned decimal byte for the digit '5' with a positive sign would be represented
as ‘F5’ (in hexadecimal), which translates to ‘1111 0101’ in binary.
9|Page
Structure of Packed Decimal Numbers
Packed decimal numbers are structured such that two decimal digits are stored in a single
byte. Each digit occupies a half-byte (or nibble), resulting in the following arrangement:
Digit Storage: Each byte consists of two nibbles:
• The first nibble represents the first decimal digit (0-9).
• The second nibble represents the second decimal digit (0-9).
For example, the decimal number '45' would be represented in packed decimal format
as ‘01000101’ in binary, where:
‘0100’ corresponds to '4'
‘0101’ corresponds to '5'
In addition to digit representation, packed decimals often include a sign bit stored in the last
nibble of the last byte. This allows for both positive and negative values to be represented
efficiently.
10 | P a g e
Sign Representation The sign stored in the last Zone bits indicate the
nibble sign
Usage Commonly used in Often used in legacy
financial applications systems
11 | P a g e
Sign Not inherently Not applicable; Zone bits indicate Sign stored in
Representation represented; represents sign (e.g., the last nibble
requires characters positive/negative). of the last byte
additional including (C for positive,
handling. control codes. D for
negative).
Character Set Limited to Supports Limited to Limited to
decimal digits (0- alphanumeric decimal digits decimal digits
9). characters and with zone bits for (0-9) with sign
control codes context. indication.
(256 characters).
Applications Used in Used in IBM Common in Widely used in
calculators and mainframes for legacy systems financial
digital systems text and applications calculations
requiring precise representation requiring easy where
decimal and data readability of precision is
representation. processing. numeric data. essential.
Conversion Simple Requires Conversion Direct
Complexity conversion mapping to/from packed or arithmetic
between decimal between BCD may be operations
and binary EBCDIC and necessary for possible
formats. other character processing. without
sets (e.g., conversion to
ASCII). other formats.
Conclusion
BCD (Binary Coded Decimal) is primarily used for precise decimal representation, making it
suitable for applications like calculators and digital systems.
EBCDIC (Extended Binary Coded Decimal Interchange Code) serves as a character encoding
scheme predominantly in IBM mainframes, supporting a wide range of alphanumeric
characters and control codes.
Zoned Decimal provides a method for representing decimal digits with zone bits indicating
context, often utilized in legacy systems requiring human-readable outputs.
Packed Decimal stands out for its storage efficiency by allowing two decimal digits per byte,
making it ideal for financial calculations where precision and memory conservation are
critical.
12 | P a g e
References
1. Gibbons, J. (2016). Understanding Binary Coded Decimal (BCD) and its applications.
Journal of Computer Science and Technology, 31(2), 123-130.
3. McCarthy, J., & Smith, T. (2018). Zoned decimal representation in legacy systems: A
comprehensive overview. International Journal of Information Systems, 14(4), 45-58.
4. Patel, R., & Kumar, S. (2019). Packed decimal numbers: Efficient storage for financial
calculations. Journal of Financial Computing and Applications, 5(1), 67-82.
5. Smith, A., & Jones, B. (2021). Comparative analysis of character encoding schemes:
BCD, EBCDIC, and ASCII. Computing Research Repository, arXiv:2101.01234.
6. University of Cincinnati Libraries. (2021). Citing computer code: Guidelines for proper
attribution.
13 | P a g e