NotAGenie
NotAGenie

Reputation: 475

How to find source of arithmetic error in IDL program?

I am debugging an existing program which appears to fail due to various arithmetic errors.

Program caused arithmetic error: Floating divide by 0

Is there a way to find out what part of the program is producing these errors? Or make the IDL development environment stop when one of these is raised?

Upvotes: 0

Views: 418

Answers (1)

NotAGenie
NotAGenie

Reputation: 475

Setting the !EXCEPT system variable to 2 will print errors for each statement, showing what file and which line caused the error.

!EXCEPT = 2

% Program caused arithmetic error: Floating divide by 0

% Detected at FUNCTION 77 /home/user/function.pro

The documentation on CHECK_MATH provides more information about how arithmetic errors are handled, in addition to the documentation on math error handling in general.

Upvotes: 0

Related Questions