FIX: Floating Point Exception Incorrect Under Win32s

ID: Q150405


The information in this article applies to:


SYMPTOMS

There are some inconsistencies in floating point exception handling under Win32s and Windows NT platforms. For example, the following code causes a underflow on both platforms as expected and the exception is masked:


   d1 = pow(1000000, -53); 


However, the following code:


   d2 = 1/d1; 


causes this behavior:


   Windows NT 3.51     -  Floating point Overflow.
   Windows 3.1/Win32s  -  Denormal operand error 


The overflow exception under Windows NT is correct, but the result under Win32s is not.


RESOLUTION

If you examine the exception record, you can see that the denormal operand status bit is set but the exception is masked in the control word. On the other hand, the overflow exception status bit is also set and the exception is unmasked. Even though the exception indication is incorrect, you can get the correct exception by examining the status and control words appropriately.


STATUS

Microsoft has confirmed this to be a bug in Win32s version 1.30. Win32s incorrectly sets the floating point exception in the above case to a Denormal operand error instead of an Overflow exception. This problem has been corrected in Win32s version 1.30c.

Additional query words: win32s fp error


Keywords          : kbWin32s 
Version           : 1.30
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: March 11, 1999