The value that overowed measured the horizontal

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: matching 2.4. FLOATING POINT Mode Round-to-even Round-toward-zero Round-down Round-up $1.40 $1 $1 $1 $2 $1.60 $2 $1 $1 $2 $1.50 $2 $1 $1 $2 $2.50 $2 $2 $2 $3 $–1.50 $–2 $–1 $–2 $–1 75 Figure 2.25: Illustration of Rounding Modes for Dollar Rounding. The first rounds to a nearest value, while the other three bound the result above or below. value ܼ that can be represented in the desired floating-point format. This is the task of the rounding operation. The key problem is to define the direction to round a value that is halfway between two possibilities. For example, if I have $1.50 and want to round it to the nearest dollar, should the result be $1 or $2? An alternative approach is to maintain a lower and an upper bound on the actual number. For example, we could determine representable values Ü and Ü· such that the value Ü is guaranteed to lie between them: Ü Ü Ü· . The IEEE floating-point format defines four different rounding modes. The default method finds a c...
View Full Document

Ask a homework question - tutors are online