#include <stdio.h>
#include <float.h>

char *status[2] = { "disabled", "enabled" };

void main()
  {
    unsigned int fp_cw = 0;
    unsigned int fp_mask = 0;
    unsigned int bits;

    fp_cw = _control87( fp_cw,
			fp_mask );

    printf( "Interrupt Exception Masks\n" );
    bits = fp_cw & MCW_EM;
    printf( "  Invalid Operation exception %s\n",
	    status[ (bits & EM_INVALID) == 0 ] );
    printf( "  Denormalized exception %s\n",
	    status[ (bits & EM_DENORMAL) == 0 ] );
    printf( "  Divide-By-Zero exception %s\n",
	    status[ (bits & EM_ZERODIVIDE) == 0 ] );
    printf( "  Overflow exception %s\n",
	    status[ (bits & EM_OVERFLOW) == 0 ] );
    printf( "  Underflow exception %s\n",
	    status[ (bits & EM_UNDERFLOW) == 0 ] );
    printf( "  Precision exception %s\n",
	    status[ (bits & EM_PRECISION) == 0 ] );

    printf( "Infinity Control = " );
    bits = fp_cw & MCW_IC;
    if( bits == IC_AFFINE )	printf( "affine\n" );
    if( bits == IC_PROJECTIVE ) printf( "projective\n" );

    printf( "Rounding Control = " );
    bits = fp_cw & MCW_RC;
    if( bits == RC_NEAR )	printf( "near\n" );
    if( bits == RC_DOWN )	printf( "down\n" );
    if( bits == RC_UP ) 	printf( "up\n" );
    if( bits == RC_CHOP )	printf( "chop\n" );

    printf( "Precision Control = " );
    bits = fp_cw & MCW_PC;
    if( bits == PC_24 ) 	printf( "24 bits\n" );
    if( bits == PC_53 ) 	printf( "53 bits\n" );
    if( bits == PC_64 ) 	printf( "64 bits\n" );
  }
