I need a sample code, that throws EXCEPTION_FLT_UNDERFLOW. I already have code to handle that exception. Now I need sample, that throws it. Any advises?
Assuming you want actual code that will trigger this:
#include <float.h>
int main()
{
_controlfp_s(NULL, 0, _MCW_EM); // enable all floating point exceptions
float f= 1.0f;
while (f)
{
f/=2.0f;
// __asm fwait; // optional, if you want to trap the underflow sooner
}
return 0;
}
Try:
RaiseException(EXCEPTION_FLT_UNDERFLOW, EXCEPTION_NONCONTINUABLE, 0, NULL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With