Practice problem 330 g cc provides a facility for

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: eclare the argument types. 3.14.7 Testing and Comparing Floating-Point Values Similar to the integer case, determining the relative values of two floating-point numbers involves using a comparison instruction to set condition codes and then testing these condition codes. For floating point, however, the condition codes are part of the floating-point status word, a 16-bit register that contains various flags about the floating-point unit. This status word must be transferred to an integer word, and then the particular bits must be tested. 3.14. *FLOATING-POINT CODE Ordered fcoms fcoml fcom fcom fcomps fcompl fcomp fcomp fcompp Unordered fucoms fucoml fucom fucom fucomps fucompl fucomp fucomp fucompp 185 Addr Addr %st( ) Addr Addr %st( ) Addr Addr %st( ) Addr Addr %st( ) ÇÔ ¾ ÅÑ ÅÑ %st( ) %st(1) ÅÑ ÅÑ %st( ) %st(1) %st(1) Ö Ö Ö Ö Type Single Double Extended Extended Single Double Extended Extended Extended Number of Pops 0 0 0 0 1 1 1 1 2 Figure 3.34: Floating-Point Comparison Instructions. Ordered vs. unordered comparisons differ in their treatment of NaN’s. ÇÔ ½ ÇÔ ¾ Binary ¼¼¼¼¼¼¼¼ ¼¼¼¼¼¼¼½ ¼¼½¼¼¼¼¼ Unordered ¼¼½¼¼½¼½ Decimal 0 1 64 69 Figure 3.35: Encoded Results from Floating-Point Comparison. The results are encoded in the highorder byte of the floating-point status word after masking out all but bits 0, 2, and 6. There are a number of different floating-point comparison instructions as documented in Figure 3...
View Full Document

Ask a homework question - tutors are online