Representing Real Numbers - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Representing Real Numbers

Description:

Real numbers have stuff after the decimal (radix) point. Scientific notation already has a radix point. How do we represent a radix point in binary? ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 11
Provided by: atkinso
Category:

less

Transcript and Presenter's Notes

Title: Representing Real Numbers


1
Representing Real Numbers
  • Scientific notation
  • Precision
  • Overflow and Underflow
  • Conversions

2
Scientific Notation
  • Why Scientific Notation?
  • What is the difference between
  • 9,000,000
  • 9.0 x 106
  • 9.0000 x 106

3
Real Numbers vs. Integers
  • Real numbers have stuff after the decimal (radix)
    point
  • Scientific notation already has a radix point
  • How do we represent a radix point in binary?

4
Standard Representation I
  • float (32 bits)
  • 1 sign, 8 exponent, 23 - mantissa
  • accuracy ? seven decimal digits
  • range ? 10-45 to 1038

5
Standard Representation II
  • double (64 bits)
  • 1 sign, 11 exponent, 52 - mantissa
  • accuracy ? fifteen decimal digits
  • range ? 10-300 to 10300

6
Precision
  • To three decimal digits, what is v2?
  • To three decimal digits, what is v2 v2?
  • To a finite-precision computer, does v2 v2
    2?

7
Underflow and Overflow
8
Conversions I
  • float to int to float
  • float a 4.5
  • int b (int) a
  • float c (float) b

9
Conversions II
  • int to float to int
  • int a 123456789
  • float b (float) a
  • int c (int) b

10
Summary
  • Be aware of format
  • Be aware of precision
  • Be aware of limits
Write a Comment
User Comments (0)
About PowerShow.com