We have access to a library function with prototype

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the largest finite 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 32-bit int): ¯ ¯ ¯ ¯ From int to float, the number cannot overflow, 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 significant bits). From double to float, the value can overflow 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 overflow. The C standard does not specify a fixed 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.

Ask a homework question - tutors are online