_controlfp() - function
-
MFC, STUDIO'2008, WINDOWS'XP 2003 #include <float.h> _controlfp(_DN_FLUSH, _MCW_DN); // : error C3861: '__controlfp': identifier not found // Denormal values flushed to zero by hardware on ALPHA and x86 // processors with SSE2 support. Ignored on other x86 platforms. below some variants: //+-1 _controlfp(0, MCW_EM); <float.h> // below following line is incorrect - don't display MessageBox(L"1\nDIVIDE BY ZERO"); _controlfp(_DN_FLUSH, _MCW_DN); _controlfp(0, _MCW_DN); _controlfp(_DN_SAVE, _MCW_DN); _controlfp(0, _MCW_DN); int err; double fResult; // Bennet, pg.136 double x,y; x = 5.0; y = 0.0; _try { fResult = x/y; // _control87_2(0, 0,&fResult, 0); //- _controlfp(0, 0,&fResult, 0); // : error C2660: '_controlfp' : function does not take 4 arguments //- _controlfp(&fResult, 0); // : error C2664: '_controlfp' : cannot convert parameter 1 from 'float *' to 'unsigned int' } _except (GetExceptionCode() == EXCEPTION_FLT_DIVIDE_BY_ZERO) { MessageBox(L"1\nDIVIDE BY ZERO"); MessageBox(_T("2\nDIVIDE BY ZERO")); AfxMessageBox(_T("3\nDIVIDE BY ZERO")); }
-
MFC, STUDIO'2008, WINDOWS'XP 2003 #include <float.h> _controlfp(_DN_FLUSH, _MCW_DN); // : error C3861: '__controlfp': identifier not found // Denormal values flushed to zero by hardware on ALPHA and x86 // processors with SSE2 support. Ignored on other x86 platforms. below some variants: //+-1 _controlfp(0, MCW_EM); <float.h> // below following line is incorrect - don't display MessageBox(L"1\nDIVIDE BY ZERO"); _controlfp(_DN_FLUSH, _MCW_DN); _controlfp(0, _MCW_DN); _controlfp(_DN_SAVE, _MCW_DN); _controlfp(0, _MCW_DN); int err; double fResult; // Bennet, pg.136 double x,y; x = 5.0; y = 0.0; _try { fResult = x/y; // _control87_2(0, 0,&fResult, 0); //- _controlfp(0, 0,&fResult, 0); // : error C2660: '_controlfp' : function does not take 4 arguments //- _controlfp(&fResult, 0); // : error C2664: '_controlfp' : cannot convert parameter 1 from 'float *' to 'unsigned int' } _except (GetExceptionCode() == EXCEPTION_FLT_DIVIDE_BY_ZERO) { MessageBox(L"1\nDIVIDE BY ZERO"); MessageBox(_T("2\nDIVIDE BY ZERO")); AfxMessageBox(_T("3\nDIVIDE BY ZERO")); }
And the question is? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
And the question is? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
The following code works fine on my system
#include "Excpt.h"
#include #include "cmath"
#include void main()
{
_controlfp(0, MCW_EM);
float fResult; // Bennet, pg.136
//int x,y;
float x,y;
// x = 5;
// y = 0;x = 5.0;
y = 0.0;
_try // __try
{
fResult = x/y;
}
//__except (GetExceptionCode() == EXCEPTION_FLT_DIVIDE_BY_ZERO)
_except (GetExceptionCode() == EXCEPTION_FLT_DIVIDE_BY_ZERO)
{
MessageBox(NULL, L"DIVIDE BY ZERO", L"", MB_OK);
}
}:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]