This preview shows page 1. Sign up to view the full content.
Unformatted text preview: the largest ﬁnite number that can be represented with double precision is around ½ ¢ ½¼¿¼ . When casting values between int, float, and double formats, the program changes the numeric values and the bit representations as follows (assuming a 32bit int): ¯ ¯ ¯ ¯ From int to float, the number cannot overﬂow, but it may be rounded. From int or float to double, the exact numeric value can be preserved because double has both greater range (i.e., the range of representable values), as well as greater precision (i.e., the number of signiﬁcant bits). From double to float, the value can overﬂow to ·½ or ½, since the range is smaller. Otherwise it may be rounded since the precision is smaller. From float or double to int the value will be truncated toward zero. For example ½ will be converted to ½, while ½ will be converted to ½. Note that this behavior is very different from rounding. Furthermore, the value may overﬂow. The C standard does not specify a ﬁxed result for this ca...
View
Full
Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
 Spring '10
 Schultz
 The American, Gulliver's Travels, 2.2.5 2.2.6 2.2.7 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5

Click to edit the document details