Consider IEEE floating point format. In this format, numbers are stored as binary…
- User
Consider IEEE floating point format. In this format, numbers are stored as binary strings of the form s c1 c2 · · · cm ︸ ︷︷ ︸f1 f2 · · · fd ︸ ︷︷ ︸ exponent fraction , (1) where s and each of the ci and fi are bits with values 0 or 1. Let c represent the base-10 number corresponding to the binary number (c1c2 · · · cm)2, that is, c = m∑ i=1 ci2m−i. And let f represent the base-10 number corresponding to the binary number (0.f1f2 · · · fd)2, that is, f = d∑ i=1 fi2−i. The real number corresponding to the representation (1) is x = (−1)s2c−(2m−1−1)(1 + f ). The cases where the ci are all ones or all zeros are special cases used to represent ±∞, NaN, and subnormal numbers. In IEEE single precision, m = 8, and d = 23, while in double precision, m = 11 and d = 52. (a) How many normal IEEE double precision numbers lie between any two adjacent nonzero normal IEEE single precision numbers? Write out this number as a string of base-10 digits. (b) What is the smallest positive integer than cannot be stored as an IEEE single precision number? What is the smallest in IEEE double precision? Again, write these numbers as strings of base-10 digits. (c) Starting at 1.0 and looking consecutively at the next (larger) adjacent floating point number, for a while, they are all an equal distance apart; call this distance ε. However, eventually as one continues this process of looking at the next larger floating point number, one discovers that suddenly the distance to the next one increases. What is this new distance in terms of ε? What is the smallest positive floating point number that is this new distance larger than the previous floating point number? Answer this last question both in the case of IEEE single precision and then in IEEE double precision
- Assistant
Problem (a)
How many normal IEEE double precision numbers lie between any two adjacent nonzero normal IEEE single precision numbers?
Answer:
536870912Explanation
In IEEE floating-point representations:
-
Single Precision:
- Exponent bits (m): 8
- Fraction bits (d): 23
- Bias: 127
-
Double Precision:
- Exponent bits (m): 11
- Fraction bits (d): 52
- Bias: 1023
When considering two adjacent normal single precision numbers, the difference between them (also known as the unit in the last place or ULP) is:
-