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 Arithmetic

How do you represent floating point numbers?

  • Floating point numbers are represented with a sign, mantissa, and exponent

  • Arithmetic operations must take into account these three components

sign-mantissa-exponent-1

Sections of a floating point number

Steps for adding or subtracting floating point numbers

  1. Ensure the numbers have the same exponent before performing arithmetic

    • This might involve shifting the decimal point of one number and adjusting its exponent until both numbers have matching exponents.

    • Example:

      • Number A: 1.101×2 cubed

      • Number B: 1.010×2 squared

      • Number A has an exponent of 2 cubed and B has an exponent of 2 squared, we need to adjust B to have the same exponent as A

      • This is achieved by moving the point one space to the left in Number B and increasing the exponent by 1

      • Resulting in: 0.101×2 cubed

  2. Perform the binary addition or subtraction on the mantissa

    • 1.101 space plus space 0.101 space equals space 10.010

  3. Ensure the result is in a normalised form

    • The sum 10.010 exceeds the normal range for mantissa (1.0 to 1.111… in binary)

    • To normalise it, we shift the mantissa one position to the right and increment the exponent by 1

    • New Mantissa: 1.0010

    • New Exponent: Increment the exponent from 2 cubed to 2 to the power of 4

    • The final result would be 1.0010×2 to the power of 4.

  4. Determine Sign

    • For addition: If both numbers are positive or negative, the result takes the common sign

    • If they have different signs, the result’s sign depends on the larger absolute value

    • For subtraction: The sign is determined by the sign of the number you’re subtracting from and the result of the subtraction

Example addition

  1. 1.100 1 subscript 2 cross times 2 cubed + <img alt=”1.011 0 subscript 2 cross times 2 squared” data-mathml='<math ><semantics><mrow><mn>1.011</mn><msub><mn>0</mn><mn>2</mn></msub><mo>&#215;</mo><msup><mn>2</mn><mn>2</mn></msup></mrow></semantics></math>’ height=”27″ role=”math” src=”data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Awrs%3D%22http%3A%2F%2Fwww.wiris.com%2Fxml%2Fmathml-extension%22%20height%3D%2227%22%20width%3D%2287%22%20wrs%3Abaseline%3D%2218%22%3E%3C!–MathML%3A%20%3Cmath%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1998%2FMath%2FMathML%22%3E%3Cmn%3E1.011%3C%2Fmn%3E%3Cmsub%3E%3Cmn%3E0%3C%2Fmn%3E%3Cmn%3E2%3C%2Fmn%3E%3C%2Fmsub%3E%3Cmo%3E%26%23xD7%3B%3C%2Fmo%3E%3Cmsup%3E%3Cmn%3E2%3C%2Fmn%3E%3Cmn%3E2%3C%2Fmn%3E%3C%2Fmsup%3E%3C%2Fmath%3E–%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%40font-face%7Bfont-family%3A’math17877d8d99e03ab35636d63f0bd’%3Bsrc%3Aurl(data%3Afont%2Ftruetype%3Bcharset%3Dutf-8%3Bbase64%2CAAEAAAAMAIAAAwBAT1MvMi7iBBMAAADMAAAATmNtYXDEvmKUAAABHAAAADxjdnQgDVUNBwAAAVgAAAA6Z2x5ZoPi2VsAAAGUAAAA3WhlYWQQC2qxAAACdAAAADZoaGVhCGsXSAAAAqwAAAAkaG10eE2rRkcAAALQAAAADGxvY2EAHTwYAAAC3AAAABBtYXhwBT0FPgAAAuwAAAAgbmFtZaBxlY4AAAMMAAABn3Bvc3QB9

Responses

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