Observe that the assembly code line fsubp is

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: represented exactly in either format, the outcome of the test is false. Before calling function do_nothing, r2 is converted and stored as a double-precision number. In computing t2, two double-precision numbers are compared, yielding true. This example demonstrates a deficiency of GCC on IA32 machines (the same result occurs for both Linux and Microsoft Windows). The value associated with a variable changes due to operations that are not visible to the programmer, such as the saving and restoring of floating-point registers. Our experiments with the Microsoft Visual C++ compiler indicate that it does not have this problem. There are several ways to overcome this problem, although none are ideal. One is to invoke GCC with the command line flag ‘-mno-fp-ret-in-387’ indicating that floating-point values should be returned on the main program stack rather than in a floating-point register. Function test1 will then show that both comparisons are true. This does not solve the problem—it just moves it to a different source of inconsistency. For example, consider the following...
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