Microsoft DirectX 8.0 (C++)

Borland Floating-Point Initialization

Compilers from Borland report floating-point exceptions in a manner that is incompatible with Microsoft® Direct3D®. To solve this problem, include a _matherr exception handler like the following:

// Borland floating point initialization 
#include <math.h>
#include <float.h>
 
void initfp(void)
{
    // Disable floating point exceptions. 
    _control87(MCW_EM,MCW_EM);
}
 
int _matherr(struct _exception  *e)
{
    e;               // Dummy reference to catch the warning.
    return 1;        // Error has been handled.
}