FIX: The fmod function returns an indeterminate (IND) value instead of the expected floating-point value in a 64-bit Visual C++ 2008 SP1 application

Symptoms

Consider the following scenario:

  • You run a 64-bit Microsoft Visual C++ 2008 Service Pack 1 (SP1) application.
  • The application is linked with floating-point modules that are written in assembly code, or that are built with a non-Microsoft C++ compiler.
  • The application calls a floating-point function in an external module that raises an x87 exception, and then calls the Visual Studio C-Runtime fmod function.

In this scenario, the returned value of the fmod function is an indeterminate (IND) value instead of the expected floating-point value.

For example, you may encounter the problem when the following conditions are true:

  • The external module that executes floating-point code was generated by the Intel C++ compiler.
  • The external module is executed on non-Intel x64 processors, such as AMD processors or VIA processors.

Note This problem also occurs when you use the fmodf function in the same scenario.

Cause

This problem occurs because of an issue in the assembly code in the 64-bit version of the fmod function. The function incorrectly treats some irrelevant flags as errors.

Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:

http:⁠//support.microsoft.com/contactus/?ws=support Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply the hotfix, you must have Visual Studio 2008 SP1 installed.

Restart requirement

You do not have to restart the computer after you apply the hotfix.

Hotfix replacement information

This hotfix replaces the following hotfixes:

972497 FIX: The fmod function returns an indeterminate (IND) value instead of the correct floating-point value in an x64-bit Visual C++ 2008 application

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of the Visual Studio 2008:

File name File version File size Date Time Platform
Atl90.dll 9.0.30729.5054 176,456 20-Aug-2010 01:06 x64
Atl90.dll 9.0.30729.5054 416,072 20-Aug-2010 01:15 IA-64
Atl90.dll 9.0.30729.5054 159,048 20-Aug-2010 02:59 x86
Array 16,417 29-Oct-2008 11:55
Random 83,273 29-Oct-2008 11:55
Tuple 12,371 29-Oct-2008 11:55
Xxfunction 9,845 29-Oct-2008 11:55
Afxframeimpl.cpp 56,204 24-Oct-2008 15:03
Afxglobals.cpp 34,156 24-Oct-2008 15:03
Afxglobals.h 10,144 24-Oct-2008 15:03
Afxtoolbarimages.cpp 76,665 19-Aug-2010 16:41
Almap.dll 18,736 19-Aug-2010 22:27 x86
Almap.lib 17,808 19-Aug-2010 22:27 x86
Atl.lib 20,012 19-Aug-2010 22:31 x86
Atl.lib 21,882 19-Aug-2010 22:49 x86
Atl.lib 19,256 19-Aug-2010 23:24 x86
Atlassem.h 2,037 19-Aug-2010 22:23
Atlbuild.h 572 19-Aug-2010 22:01
Atlcom.h 173,186 10-Aug-2010 22:27
Atlcomcli.h 68,589 11-Aug-2010 12:28
Atldb.h 384,029 19-Aug-2010 15:47
Atldload.lib 396,148 19-Aug-2010 22:31 x86
Atldload.lib 493,480 19-Aug-2010 22:49 x86
Atldload.lib 429,022 19-Aug-2010 23:24 x86
Atlhost.h 77,913 10-Aug-2010 19:50
Atls.lib 1,413,006 19-Aug-2010 22:31 x86
Atls.lib 1,354,526 19-Aug-2010 22:49 x86
Atls.lib 1,114,536 19-Aug-2010 23:24 x86
Atlsd.lib 1,784,144 19-Aug-2010 22:31 x86
Atlsd.lib 2,031,798 19-Aug-2010 22:49 x86
Atlsd.lib 1,605,960 19-Aug-2010 23:24 x86
Bardock.cpp 25,372 30-Aug-2010 09:15
Comdef.h 8,731 12-Aug-2010 15:14
Complex.1.7417.cn.ln 33,628 12-Aug-2010 15:14
Complex.7294.cn.ln 32,105 12-Aug-2010 17:54
Crtassem.h 951 19-Aug-2010 22:22 x86
Crtassem.h 1,298 19-Aug-2010 22:23
Crtdefs.h 107,919 19-Aug-2010 22:23
Crtdefs.h 97,327 12-Aug-2010 17:54 x86
Dbgheap.c.4074.cn.ln 105,748 19-Aug-2010 22:23
Deque.1.7431.cn.ln 39,247 12-Aug-2010 15:14
Deque.7308.cn.ln 39,247 12-Aug-2010 17:54
Fctional.1.7437.cn.ln 35,120 12-Aug-2010 15:14
Fctional.7314.cn.ln 35,120 12-Aug-2010 17:54
Hash.map.1.13876.cn.ln 9,462 12-Aug-2010 15:14
Hash.map.9791.cn.ln 9,462 12-Aug-2010 17:54
Hash.set.1.13877.cn.ln 8,183 12-Aug-2010 15:14
Hash.set.9792.cn.ln 8,183 12-Aug-2010 17:54
Intrin.h 89,129 12-Aug-2010 17:54 x86
Intrin.h 91,683 19-Aug-2010 22:23
Iosfwd.1.7447.cn.ln 30,413 12-Aug-2010 15:14
Iosfwd.7324.cn.ln 24,926 12-Aug-2010 17:54
Istream.1.7451.cn.ln 35,064 12-Aug-2010 19:36
Istream.7328.cn.ln 32,660 12-Aug-2010 19:37
Libcmt.lib 9,217,408 19-Aug-2010 22:31 x86
Libcmt.lib 12,760,908 19-Aug-2010 22:43 x86
Libcmt.lib 10,007,012 19-Aug-2010 23:24 x86
Libcmtd.lib 11,361,330 19-Aug-2010 22:31 x86
Libcmtd.lib 16,469,324 19-Aug-2010 22:44 x86
Libcmtd.lib 12,749,536 19-Aug-2010 23:24 x86
Libcpmt.lib 5,349,928 19-Aug-2010 22:31 x86
Libcpmt.lib 8,755,304 19-Aug-2010 22:45 x86
Libcpmt.lib 6,963,462 19-Aug-2010 23:24 x86
Libcpmtd.lib 6,781,270 19-Aug-2010 22:31 x86
Libcpmtd.lib 11,714,090 19-Aug-2010 22:45 x86
Libcpmtd.lib 9,299,518 19-Aug-2010 23:24 x86
Mfc90.lib 5,196,148 19-Aug-2010 23:52 x64
Mfc90.lib 5,197,224 19-Aug-2010 23:16 x86
Mfc90d.lib 6,026,792 19-Aug-2010 23:53 x64
Mfc90d.lib 6,017,756 19-Aug-2010 23:16 x86
Mfc90u.lib 6,501,186 19-Aug-2010 23:53 x64
Mfc90u.lib 6,595,792 19-Aug-2010 23:17 x86
Mfc90ud.lib 7,541,862 19-Aug-2010 23:53 x64
Mfc90ud.lib 7,622,206 19-Aug-2010 23:17 x86
Mfc.bsc 18,705,408 20-Aug-2010 00:53
Mfc_loc.manifest 5,882 20-Aug-2010 03:03 x86
Mfcassem.h 3,143 19-Aug-2010 22:54
Mfcdload.lib 780,354 19-Aug-2010 23:50 x86
Mfcm90.lib 43,104 19-Aug-2010 23:54 x64
Mfcm90.lib 41,052 19-Aug-2010 23:18 x86
Mfcm90d.lib 46,182 19-Aug-2010 23:54 x64
Mfcm90d.lib 44,596 19-Aug-2010 23:18 x86
Mfcm90u.lib 44,548 19-Aug-2010 23:54 x64
Mfcm90u.lib 42,460 19-Aug-2010 23:18 x86
Mfcm90ud.lib 47,640 19-Aug-2010 23:54 x64
Mfcm90ud.lib 46,014 19-Aug-2010 23:18 x86
Mfcs90.lib 1,054,706 19-Aug-2010 23:50 x86
Mfcs90.lib 1,048,944 19-Aug-2010 23:14 x86
Mfcs90d.lib 1,049,108 19-Aug-2010 23:50 x64
Mfcs90d.lib 1,020,312 19-Aug-2010 23:14 x86
Mfcs90u.lib 1,068,310 19-Aug-2010 23:51 x64
Mfcs90u.lib 1,063,030 19-Aug-2010 23:15 x86
Mfcs90ud.lib 1,065,496 19-Aug-2010 23:51 x86
Mfcs90ud.lib 1,035,730 19-Aug-2010 23:14 x86
Microsoft.vc90.atl.manifest 858 20-Aug-2010 01:10 x64
Microsoft.vc90.atl.manifest 857 20-Aug-2010 01:20 IA-64
Microsoft.vc90.atl.manifest 856 20-Aug-2010 03:03 x86
Microsoft_vc90_atl_x86_ia64.msm 229,888 20-Aug-2010 11:29 IA-64
Microsoft_vc90_atl_x86.msm 150,528 20-Aug-2010 09:54 x86
Microsoft_vc90_atl_x86_x64.msm 151,552 20-Aug-2010 10:45 x64
Microsoft.vc90.crt.manifest 1,862 20-Aug-2010 01:10 x64
Microsoft.vc90.crt.manifest 1,861 20-Aug-2010 01:20 IA-64
Microsoft.vc90.crt.manifest 1,860 20-Aug-2010 03:03 x86
Microsoft_vc90_crt_x86_ia64.msm 1,041,408 20-Aug-2010 11:24 IA-64
Microsoft_vc90_crt_x86.msm 614,912 20-Aug-2010 09:18 x86
Microsoft_vc90_crt_x86_x64.msm 648,192 20-Aug-2010 10:39 x64
Microsoft.vc90.debugcrt.manifest 1,870 20-Aug-2010 01:10 x64
Microsoft.vc90.debugcrt.manifest 1,869 20-Aug-2010 01:20 IA-64
Microsoft.vc90.debugcrt.manifest 1,868 20-Aug-2010 03:03 x86
Microsoft_vc90_debugcrt_x86_ia64.msm 1,811,456 20-Aug-2010 11:19 IA-64
Microsoft_vc90_debugcrt_x86.msm 839,168 20-Aug-2010 09:12 x86
Microsoft_vc90_debugcrt_x86_x64.msm 844,288 20-Aug-2010 10:34 x64
Microsoft.vc90.debugmfc.manifest 2,368 20-Aug-2010 01:10 x64
Microsoft.vc90.debugmfc.manifest 2,366 20-Aug-2010 03:03 x86
Microsoft_vc90_debugmfc_x86_ia64.msm 4,759,040 07-Nov-2007 05:58 IA-64
Microsoft_vc90_debugmfc_x86.msm 5,569,024 20-Aug-2010 09:39 x86
Microsoft_vc90_debugmfc_x86_x64.msm 5,985,792 20-Aug-2010 10:24 x64
Microsoft.vc90.debugopenmp.manifest 867 20-Aug-2010 03:03 x86
Microsoft.vc90.debugopenmp.manifest 868 20-Aug-2010 01:20 x86
Microsoft.vc90.debugopenmp.manifest 869 20-Aug-2010 01:10 x86
Microsoft_vc90_debugopenmp_x86_ia64.msm 157,696 20-Aug-2010 10:50 IA-64
Microsoft_vc90_debugopenmp_x86.msm 108,544 20-Aug-2010 09:23 x86
Microsoft_vc90_debugopenmp_x86_x64.msm 107,520 20-Aug-2010 09:59 x64
Microsoft.vc90.mfc.manifest 2,359 20-Aug-2010 01:10 x64
Microsoft.vc90.mfc.manifest 2,357 20-Aug-2010 03:03 x86
Microsoft_vc90_mfc_x86_ia64.msm 2,600,960 07-Nov-2007 06:10 IA-64
Microsoft_vc90_mfc_x86.msm 4,188,160 20-Aug-2010 09:46 x86
Microsoft_vc90_mfc_x86_x64.msm 4,883,456 20-Aug-2010 10:29 x64
Microsoft.vc90.mfcloc.manifest 5,884 20-Aug-2010 01:10 x64
Microsoft.vc90.mfcloc.manifest 5,882 20-Aug-2010 03:03 x86
Microsoft_vc90_mfcloc_x86_ia64.msm 242,176 07-Nov-2007 06:18 IA-64
Microsoft_vc90_mfcloc_x86.msm 259,072 20-Aug-2010 09:33 x86
Microsoft_vc90_mfcloc_x86_x64.msm 257,024 20-Aug-2010 10:18 x64
Microsoft.vc90.openmp.manifest 861 20-Aug-2010 03:03 x86
Microsoft.vc90.openmp.manifest 862 20-Aug-2010 01:20 x86
Microsoft.vc90.openmp.manifest 863 20-Aug-2010 01:10 x86
Microsoft_vc90_openmp_x86_ia64.msm 124,416 20-Aug-2010 10:55 IA-64
Microsoft_vc90_openmp_x86.msm 98,304 20-Aug-2010 09:28 x86
Microsoft_vc90_openmp_x86_x64.msm 98,816 20-Aug-2010 10:13 x64
Msvcmrt.lib 1,529,808 19-Aug-2010 22:31 x86
Msvcmrt.lib 1,697,612 19-Aug-2010 23:24 x86
Msvcmrt.lib 1,846,526 19-Aug-2010 22:46 x86
Msvcmrtd.lib 1,625,960 19-Aug-2010 22:31 x86
Msvcmrtd.lib 1,804,926 19-Aug-2010 23:24 x86
Msvcmrtd.lib 1,956,882 19-Aug-2010 22:47 x86
Msvcprt.lib 1,654,516 19-Aug-2010 22:31 x86
Msvcprt.lib 2,140,986 19-Aug-2010 22:45 x86
Msvcprt.lib 1,686,818 19-Aug-2010 23:24 x86
Msvcprtd.lib 1,827,186 19-Aug-2010 22:31 x86
Msvcprtd.lib 2,369,332 19-Aug-2010 22:45 x86
Msvcprtd.lib 1,860,040 19-Aug-2010 23:24 x86
Msvcrt.lib 1,360,068 19-Aug-2010 22:31 x86
Msvcrt.lib 1,585,296 19-Aug-2010 22:44 x86
Msvcrt.lib 1,357,322 19-Aug-2010 23:24 x86
Msvcrtd.lib 1,392,990 19-Aug-2010 22:31 x86
Msvcrtd.lib 1,642,428 19-Aug-2010 22:44 x86
Msvcrtd.lib 1,400,234 19-Aug-2010 23:24 x86
Msvcurt.lib 15,375,466 19-Aug-2010 22:31 x86
Msvcurt.lib 15,737,148 19-Aug-2010 23:24 x86
Msvcurt.lib 15,882,482 19-Aug-2010 22:46 x86
Msvcurtd.lib 16,952,226 19-Aug-2010 22:31 x86
Msvcurtd.lib 17,303,538 19-Aug-2010 23:24 x86
Msvcurtd.lib 17,454,852 19-Aug-2010 22:47 x86
Nafxcw.lib 49,963,836 19-Aug-2010 23:17 x86
Nafxcw.lib 59,306,388 19-Aug-2010 23:53 x86
Nafxcwd.lib 52,949,400 19-Aug-2010 23:16 x86
Nafxcwd.lib 66,787,592 19-Aug-2010 23:53 x86
Nmmintrin.h 4,091 19-Aug-2010 22:23 x86
Nmmintrin.h 3,967 12-Aug-2010 17:54
Ompassem.h 951 19-Aug-2010 22:56
Ptrustm.lib 426,518 19-Aug-2010 22:31 x86
Ptrustmd.lib 433,690 19-Aug-2010 22:31 x86
Ptrustu.lib 426,518 19-Aug-2010 22:31 x86
Ptrustud.lib 433,690 19-Aug-2010 22:31 x86
Sdknames.lib 7,462 19-Aug-2010 22:27 x86
Sstream.1.7482.cn.ln 17,720 12-Aug-2010 15:14
Sstream.7358.cn.ln 16,685 12-Aug-2010 17:54
Stat64.c.4424.cn.ln 11,106 19-Aug-2010 22:23
Stat.c.4423.cn.ln 12,726 19-Aug-2010 22:23
Tcmap.lib 29,676 19-Aug-2010 22:27 x86
Tcmapdll.lib 32,058 19-Aug-2010 22:27 x86
Uafxcw.lib 50,880,300 19-Aug-2010 23:17 x86
Uafxcw.lib 60,097,306 19-Aug-2010 23:54 x86
Uafxcwd.lib 54,310,594 19-Aug-2010 23:17 x86
Uafxcwd.lib 68,073,040 19-Aug-2010 23:53 x86
Mfc90.dll 9.0.30729.5054 5,083,464 20-Aug-2010 01:06 x64
Mfc90.dll 9.0.30729.5054 3,765,064 20-Aug-2010 02:59 x86
Mfc90chs.dll 9.0.30729.5054 35,664 20-Aug-2010 01:06 x64
Mfc90chs.dll 9.0.30729.5054 35,664 20-Aug-2010 02:59 x86
Mfc90cht.dll 9.0.30729.5054 36,688 20-Aug-2010 01:06 x64
Mfc90cht.dll 9.0.30729.5054 36,688 20-Aug-2010 02:59 x86
Mfc90d.dll 9.0.30729.5054 7,418,184 20-Aug-2010 01:06 x64
Mfc90d.dll 9.0.30729.5054 5,933,896 20-Aug-2010 02:59 x86
Mfc90deu.dll 9.0.30729.5054 63,312 20-Aug-2010 01:06 x64
Mfc90deu.dll 9.0.30729.5054 63,312 20-Aug-2010 02:59 x86
Mfc90enu.dll 9.0.30729.5054 53,584 20-Aug-2010 01:06 x64
Mfc90enu.dll 9.0.30729.5054 53,584 20-Aug-2010 02:59 x86
Mfc90esn.dll 9.0.30729.5054 61,776 20-Aug-2010 01:06 x64
Mfc90esn.dll 9.0.30729.5054 61,776 20-Aug-2010 02:59 x86
Mfc90esp.dll 9.0.30729.5054 61,776 20-Aug-2010 01:06 x64
Mfc90esp.dll 9.0.30729.5054 61,776 20-Aug-2010 02:59 x86
Mfc90fra.dll 9.0.30729.5054 62,800 20-Aug-2010 01:06 x64
Mfc90fra.dll 9.0.30729.5054 62,800 20-Aug-2010 02:59 x86
Mfc90ita.dll 9.0.30729.5054 61,264 20-Aug-2010 01:06 x64
Mfc90ita.dll 9.0.30729.5054 61,264 20-Aug-2010 02:59 x86
Mfc90jpn.dll 9.0.30729.5054 43,344 20-Aug-2010 01:06 x64
Mfc90jpn.dll 9.0.30729.5054 43,344 20-Aug-2010 02:59 x86
Mfc90kor.dll 9.0.30729.5054 42,832 20-Aug-2010 01:06 x64
Mfc90kor.dll 9.0.30729.5054 42,832 20-Aug-2010 02:59 x86
Mfc90rus.dll 9.0.30729.5054 59,728 20-Aug-2010 01:06 x64
Mfc90rus.dll 9.0.30729.5054 59,728 20-Aug-2010 02:59 x86
Mfc90u.dll 9.0.30729.5054 5,102,408 20-Aug-2010 01:06 x64
Mfc90u.dll 9.0.30729.5054 3,780,424 20-Aug-2010 02:59 x86
Mfc90ud.dll 9.0.30729.5054 7,463,248 20-Aug-2010 01:06 x64
Mfc90ud.dll 9.0.30729.5054 5,979,472 20-Aug-2010 02:59 x86
Mfcm90.dll 9.0.30729.5054 67,072 20-Aug-2010 01:06 x64
Mfcm90.dll 9.0.30729.5054 59,904 20-Aug-2010 03:00 x86
Mfcm90d.dll 9.0.30729.5054 93,184 20-Aug-2010 01:06 x64
Mfcm90d.dll 9.0.30729.5054 80,896 20-Aug-2010 03:00 x86
Mfcm90u.dll 9.0.30729.5054 67,072 20-Aug-2010 01:06 x64
Mfcm90u.dll 9.0.30729.5054 59,904 20-Aug-2010 03:00 x86
Mfcm90ud.dll 9.0.30729.5054 93,696 20-Aug-2010 01:06 x64
Mfcm90ud.dll 9.0.30729.5054 80,896 20-Aug-2010 03:00 x86
Mfcmifc80u.dll 9.0.30729.5054 13,136 20-Aug-2010 23:00 x86
Microsoft.visualc.stlclr.dll 9.0.30729.5054 47,984 20-Aug-2010 23:00 x86
Msvcm90.dll 9.0.30729.5054 245,760 20-Aug-2010 01:06 x64
Msvcm90.dll 9.0.30729.5054 324,096 20-Aug-2010 01:15 IA-64
Msvcm90.dll 9.0.30729.5054 225,280 20-Aug-2010 03:00 x86
Msvcm90d.dll 9.0.30729.5054 333,312 20-Aug-2010 01:06 x64
Msvcm90d.dll 9.0.30729.5054 429,568 20-Aug-2010 01:15 IA-64
Msvcm90d.dll 9.0.30729.5054 312,832 20-Aug-2010 03:00 x86
Msvcp90.dll 9.0.30729.5054 853,328 20-Aug-2010 01:06 x64
Msvcp90.dll 9.0.30729.5054 1,466,192 20-Aug-2010 01:15 IA-64
Msvcp90.dll 9.0.30729.5054 569,680 20-Aug-2010 02:59 x86
Msvcp90d.dll 9.0.30729.5054 1,120,592 20-Aug-2010 01:06 x64
Msvcp90d.dll 9.0.30729.5054 2,515,280 20-Aug-2010 01:15 IA-64
Msvcp90d.dll 9.0.30729.5054 871,760 20-Aug-2010 02:59 x86
Msvcr90.dll 9.0.30729.5054 624,464 20-Aug-2010 01:06 x64
Msvcr90.dll 9.0.30729.5054 1,505,616 20-Aug-2010 01:15 IA-64
Msvcr90.dll 9.0.30729.5054 653,136 20-Aug-2010 02:59 x86
Msvcr90d.dll 9.0.30729.5054 1,350,480 20-Aug-2010 01:06 x64
Msvcr90d.dll 9.0.30729.5054 3,603,280 20-Aug-2010 01:15 IA-64
Msvcr90d.dll 9.0.30729.5054 1,178,448 20-Aug-2010 02:59 x86

Workaround

To work around this problem, assemble a wrapper function that calls an fnclex instruction before the wrapper function calls the fmod function. The following code is an example of how to assemble the wrapper function:
public <Function Name> <Function Name> proc fnclex call fmod ret <Function Name> endp

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.