// floating point unusual control position #define fpuem_invalidop 0x01 # define fpuem_denormalop 0x02 # define fpuem_zerodivide 0x04 # define fpuem_overflow 0x08 # define fpuem_underflow 0x10 # define fpuem_precison 0x20
#define __force_inline____inline / * ------------------------------------------------------------------------------------------------------------------------------------ -------------- Open the specified floating point abnormality ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------- * / __ force_inline__ static void enablefloatexception (_ e e = 0x000f) {__INT16 CW; __ASM {NOT EXCWORD FSTCW CW MOV AX, ExcWord and CW, AX FLDCW CW}}
/ * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- Close the specified floating point abnormality -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------- * / __ force_inline__ static void disablefloatexception (_ e = = 0x000f) {__INT16 CW; __ASM {FSTCW CW MOV AX, ExcWord OR CW, AX FLDCW CW}}
INT _TMAIN (int Argc, _tchar * argv []) {int a = 10; float b = 0; float c; float pi = 3.1415926 / 2.0; __INT16 CW = 0x0000;
Enablefloatexception (); c = a / b; disablefloatexception (); c = a / b; returnif;}