External Interfaces Previous page   Next Page

Masking Floating-Point Exceptions

Read this section if you plan to build with the Borland C++ compiler on Windows. It explains how to avoid program termination when a floating-point exception occurs.

Certain mathematical operations can result in nonfinite values. For example, division by zero results in the nonfinite IEEE value, inf. A floating-point exception occurs when such an operation is performed. Because MATLAB uses an IEEE model that supports nonfinite values such as inf and NaN, MATLAB disables, or masks, floating-point exceptions.

Some compilers do not mask floating-point exceptions by default. This causes engine programs built with such compilers to terminate when a floating-point exception occurs. Consequently, you need to take special precautions when using these compilers to mask floating-point exceptions so that your engine application will perform properly.

The only compiler and platform on which you need to mask floating-point exceptions is the Borland C++ compiler on Windows.

Borland C++ Compiler on Windows

To mask floating-point exceptions when using the Borland C++ compiler on the Windows platform, you must add some code to your program. Include the following at the beginning of your main() or WinMain() function, before any calls to MATLAB API functions.


Previous page  Example -- Building an Engine Application on Windows Calling Java from MATLAB Next page

© 1994-2005 The MathWorks, Inc.