Computer-science_A-level_Cie
-
computers-and-components6 主题
-
logic-gates-and-logic-circuits2 主题
-
central-processing-unit-cpu-architecture6 主题
-
assembly-language-4 主题
-
bit-manipulation1 主题
-
operating-systems3 主题
-
language-translators2 主题
-
data-security3 主题
-
data-integrity1 主题
-
ethics-and-ownership3 主题
-
database-concepts3 主题
-
database-management-systems-dbms-1 主题
-
data-definition-language-ddl-and-data-manipulation-language-dml1 主题
-
computational-thinking-skills1 主题
-
algorithms14 主题
-
data-types-and-records2 主题
-
arrays2 主题
-
files1 主题
-
introduction-to-abstract-data-types-adt1 主题
-
programming-basics1 主题
-
constructs2 主题
-
structured-programming1 主题
-
program-development-life-cycle2 主题
-
program-design-2 主题
-
program-testing-and-maintenance3 主题
-
user-defined-data-types1 主题
-
file-organisation-and-access-3 主题
-
floating-point-numbers-representation-and-manipulation3 主题
-
protocols2 主题
-
circuit-switching-packet-switching1 主题
-
processors-parallel-processing-and-virtual-machines5 主题
-
boolean-algebra-and-logic-circuits4 主题
-
purposes-of-an-operating-system-os3 主题
-
translation-software3 主题
-
encryption-encryption-protocols-and-digital-certificates3 主题
-
artificial-intelligence-ai4 主题
-
recursion1 主题
-
programming-paradigms4 主题
-
object-oriented-programming7 主题
-
file-processing-and-exception-handling2 主题
-
data-representation5 主题
-
multimedia3 主题
-
compression2 主题
-
networks-and-the-internet11 主题
floating-point-basics
Floating-point binary
What is floating-point binary?
-
Floating-point binary is a method of representing real numbers in binary, including fractions and very large or very small values
-
Uses scientific notation in base-2
-
Unlike fixed-point (where the binary point is fixed), the binary point can “float” using a mantissa and an exponent
Why use floating-point?
-
Can represent a much wider range of numbers
-
Provides more precision for fractional values
-
Makes efficient use of limited storage (e.g. 8-bit, 16-bit representations)
Components of floating-point
|
Component |
Description |
|---|---|
|
Mantissa |
|
|
Exponent |
|
Example in decimal
3.14 × 10³
-
Mantissa = 3.14
-
Exponent = 3
Example in binary
110.01₂ = 0.11001 × 2³
-
Mantissa =
011001…(sign 0, fraction 11001 padded to available bits) -
Exponent =
0011(+3 in two’s complement)
Positive floating-point representation
-
Sign bit = 0
-
Fraction part stored in the remaining mantissa bits
-
Exponent shifts the binary point
Negative floating-point representation
-
Sign bit = 1
-
Fraction part stored in the remaining mantissa bits
-
Exponent is in two’s complement
-
Example:
-
−6.25 = 110.01₂ = 0.11001 × 2³ -
Mantissa =
111001000000(sign = 1, fraction = 11001 padded) -
Exponent =
0011
-
Normalising floating-point numbers
-
A floating-point number is normalised when the mantissa begins with:
-
01for positive numbers -
10for negative numbers
-
Why normalise?
|
Reason |
Explanation |
|---|---|
|
Consistency |
All numbers follow the same structure |
|
Precision |
Leading zeros removed so mantissa makes full use of available bits |
|
Easier processing |
Arithmetic and comparisons are simpler |
Steps to normalise a floating-point number
-
Shift the binary point until the mantissa begins with
01(positive) or10(negative) -
Adjust the exponent by the number of shifts:
-
Moving left → increase exponent
-
Moving right → decrease exponent
-
Example
-
Before normalisation:
-
Mantissa =
00011 -
Exponent =
0010(+2)
-
-
Process:
-
Shift binary point 2 places right → mantissa =
01100 -
Decrease exponent by 2 → exponent =
0000
-
-
After normalisation:
-
Mantissa =
01100 -
Exponent =
0000
-
Examiner Tips and Tricks
-
Remember: mantissa sign = first bit, not two’s complement
-
Only the exponent uses two’s complement
-
In CIE questions, always write mantissas as
0.xxxxx × 2ⁿ, not1.xxxxx × 2ⁿ(that’s IEEE)
Responses