Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.

Similar presentations


Presentation on theme: "Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001."— Presentation transcript:

1 Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001

2 Representations of numbers Unsigned integers Signed integers  Fixed-point numbers  Floating-point numbers

3 Base-10 (decimal) arithmetic Uses the ten numbers from 0 to 9 Each column represents a power of 10

4 Base-10 (decimal) arithmetic Uses the ten numbers from 0 to 9 Each column represents a power of 10

5 Standard binary representation Uses the two numbers from 0 to 1 Every column represents a power of 2

6 Fixed-point representation Uses the two numbers from 0 to 1 Every column represents a power of 2

7 Addition Base-10Base-2

8 Conversion to base 10

9 Questions about binary data Is it signed or unsigned? What exponent is used for each place?

10 Range of values in a byte

11 Scientific notation (1) One billion =1,000,000,000 =1 x 10 9 –significand or mantissa: 1 –base or radix: 10 –exponent: 9

12 Scientific notation (2) 1999 =1.999 x 10 3 –significand or mantissa: 1999 –base or radix: 10 –exponent: 3 =19.99 x 10 =199.9 x 10

13 Practice (base 10) 258 24.25

14 Base-2 scientific notation 2.25 ten =10.01 two =10.01 two x 2 0 =1.001 two x 2 1  normalized

15 8-bit floating point format (1) Note: This isn’t a standard format. It’s just for teaching purposes.

16 Improvements Bias the exponent –Always subtract a fixed amount, e.g., 3 –Allows representation of negative exponents Implicit one –What’s the Mills phone number? –Why use a bit for the leading one?

17 8-bit floating-point format (2) Exponent (3 bits) is biased by 3 The leading one of significand is implicit Zero is represented by all zeros

18 IEEE standard floating-point Single precision –32 bits sign: 1 bit exponent: 8 bits significand: 23 bits –Bias: 127 Double precision –64 bits sign: 1 bit exponent: 11 bits significand: 52 bits –Bias: 511

19 Practice 13 ten 1.25 ten 257 ten

20

21


Download ppt "Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001."

Similar presentations


Ads by Google