Back to 课程

Computer-Science-A-level-Ocr

0% Complete
0/0 Steps
  1. 3-3-networks
    8 主题
  2. 3-2-databases
    7 主题
  3. 3-1-compression-encryption-and-hashing
    4 主题
  4. 2-5-object-oriented-languages
    7 主题
  5. 2-4-types-of-programming-language
    4 主题
  6. 2-3-software-development
    5 主题
  7. 2-2-applications-generation
    6 主题
  8. 2-1-systems-software
    8 主题
  9. 1-3-input-output-and-storage
    2 主题
  10. 1-2-types-of-processor
    3 主题
  11. 1-1-structure-and-function-of-the-processor
    1 主题
  12. structuring-your-responses
    3 主题
  13. the-exam-papers
    2 主题
  14. 8-2-algorithms-for-the-main-data-structures
    4 主题
  15. 8-1-algorithms
    10 主题
  16. 7-2-computational-methods
    11 主题
  17. 7-1-programming-techniques
    14 主题
  18. 6-5-thinking-concurrently
    2 主题
  19. 6-4-thinking-logically
    2 主题
  20. 6-3-thinking-procedurally
    3 主题
  21. 6-2-thinking-ahead
    1 主题
  22. 6-1-thinking-abstractly
    3 主题
  23. 5-2-moral-and-ethical-issues
    9 主题
  24. 5-1-computing-related-legislation
    4 主题
  25. 4-3-boolean-algebra
    5 主题
  26. 4-2-data-structures
    10 主题
  27. 4-1-data-types
    9 主题
  28. 3-4-web-technologies
    16 主题
课 Progress
0% Complete

Floating Point Binary

What is floating point binary?

  • Floating point binary addresses the limitations of fixed-point binary in representing a wide array of real numbers

  • It allows for both fractional and whole-number components

  • It accommodates extremely large and small numbers by adjusting the floating point

  • It optimises storage and computational resources for most applications

Mantissa and exponent

  • In A Level Computer Science, the mantissa and exponent are the two main components of a floating point number:

    • Mantissa

      • The part of the number that holds the actual digits of the value

      • It represents the precision of the number but does not determine its scale

    • Exponent

      • Controls how far the binary point moves, effectively scaling the number up or down

      • A larger exponent moves the point to the right (making a larger number), while a smaller exponent moves it to the left (making a smaller number)

  • For example, in standard scientific notation, the decimal number 3.14 × 10³ has:

    • Mantissa: 3.14 (the significant digits)

    • Exponent: 3 (which shifts the decimal point three places to the right)

  • Floating point binary works similarly but in base-2

  • Instead of multiplying by powers of 10, it multiplies by powers of 2 using a binary exponent

Representation of floating point

  • The appearance of floating-point binary is mostly the same except for the presence the decimal point

Binary representation of 7.875 as a floating point number, showing bit values for 16, 8, 4, 2, 1, 0.5, 0.25, and 0.125.
  • In the example above, an 8-bit number can represent a whole number and fractional elements

  • The point is always placed between the whole and fractional values

  • The consequence of floating point binary is a significantly reduced maximum value

  • The benefit of floating point binary is increased precision

Representation of negative floating point

  • Negative numbers can also be represented in floating point form using two’s Complement

  • The MSB is used to represent the negative offset of the number, and the bits that follow it are used to count upwards

  • The fractional values are then added to the whole number

Binary to decimal conversion, showing powers of two and fractional components resulting in the decimal value -9.875.

Converting Denary to Floating Point

Denary to floating point binary

Example: Convert 6.75 to floating point binary

Step 1: Represent the number in fixed point binary. 

-8

4

2

1

.

0.5

0.25

0

1

1

0

.

1

1

Step 2: Move the decimal point.

0

.

1

1

0

1

1

Step 3: Calculate the exponent 

The decimal point has moved three places to the left and therefore has an exponent value of three

-4

2

1

0

1

1

Step 4: Calculate the final answer:

Mantissa: 011011

Exponent: 011

Converting Floating Point to Denary

Binary floating point to denary

Example: Convert this floating point number to denary:

  • Mantissa – 01100

  • Exponent – 011

Step 1: Write out the binary number. 

0

.

1

1

0

0

Step 2: Work out the exponent value.

The exponent value is 3. 

-4

2

1

0

1

1

Step 3: Move the decimal point three places to the right. 

-8

4

2

1

.

0.5

0

1

1

0

.

0

Step 4: Calculate the final answer: 6

Normalising Floating Point Binary

  • A floating point number is said to be normalised when it starts with 01 or 10

Why normalise?

  • Ensures a consistent format for floating point representation

  • Makes arithmetic and comparisons more straightforward

Steps to normalise a floating point number

  1. Shift the decimal point left or right until it starts with a 01 or 10

  2. Adjust the exponent value accordingly as you move the decimal point

    • Moving the point to the left increases the exponent and vice versa

  • Example

    • Before normalisation:

      • Mantissa = 0.0011

      • Exponent = 0010 (2)

  • After normalisation:

    • Mantissa = 0.1100

      • Decimal point has moved 2 places to right so it starts with 01

    • Exponent = 0000 (0)

      • Exponent has been reduced by 2

Decode a normalised floating point binary number

  • In A Level Computer Science, you may be given a floating point number made up of two parts:

    • A 4-bit mantissa (in two’s complement)

    • A 4-bit exponent (also in two’s complement)

  • For example:

    • 1101 1111

    • Mantissa = 1101

    • Exponent = 1111

Step 1: Convert the exponent to denary

  • The exponent is stored in 4-bit two’s complement, so:

    • If the first bit is 0 → it’s a positive number

    • If the first bit is 1 → it’s negative

  • Example:

Exponent: 1111 → two’s complement = -1

Step 2: Convert the mantissa to binary

  • The mantissa is also in 4-bit two’s complement

  • Convert it to a denary number.

  • Then convert it to a binary value, assuming the binary point goes just after the first bit (because it’s normalised)

  • Example:

Mantissa: 1101 → two’s complement = -3

Binary of 3 = 011

So -3 in normalised binary = -0.110 (we assume a leading 1 is implied)

Step 3: Shift the binary point

  • Now shift the binary point by the exponent value.

    • If exponent is positive, move the point to the right

    • If exponent is negative, move it to the left

  • Example:

Start with: -0.110

Exponent = -1

Shift the point 1 place left → -0.0110

Step 4: Convert to denary

  • Now convert the final binary number into denary

-0.0110 =

0 × ½ = 0

1 × ¼ = 0.25

1 × ⅛ = 0.125

0 × 1/16 = 0

Final value = -0.25 - 0.125 = -0.375

  • Answer: –0.375

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注