Re: Math errors tracked! To a built-in library... [message #78221] |
Wed, 02 November 2011 12:54 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ed Hyer writes:
>
> On Nov 2, 10:19 am, David Fanning <n...@dfanning.com> wrote:
>> Are you *certain* you are calling the IDL version of the MEAN
>> function?
>
> % Detected at MEAN 1 /usr/local/itt/idl71/lib/mean.pro
>
> FILE_WHICH() agrees.
Well, then I would replace the ON_ERROR, 2
call in Mean with this:
Catch, theError
IF theError NE 0 THEN BEGIN
Catch, /CANCEL
void = Error_Message()
RETURN
ENDIF
That will allow you to track the error.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: Math errors tracked! To a built-in library... [message #78232 is a reply to message #78224] |
Wed, 02 November 2011 10:19  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ed Hyer writes:
> The obstacle is that the debug information IDL is providing gives me
> nothing to go on about where to locate the /0. MEAN is called directly
> in only about 20 places in the code I am looking to debug, but I
> strongly suspect that some other IDL "builtins" call MEAN as well.
>
> How can I get the stack trace of math errors, rather than just the
> useless information that MEAN was called with a bad input?
Are you *certain* you are calling the IDL version of the MEAN
function?
IDL> Print, File_Which('mean.pro')
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Math errors tracked! To a built-in library... [message #78235 is a reply to message #78232] |
Wed, 02 November 2011 10:06  |
MarioIncandenza
Messages: 231 Registered: February 2005
|
Senior Member |
|
|
On Nov 2, 8:42 am, Craig Markwardt <craig.markwa...@gmail.com> wrote:
> Perhaps you are supplying an array with all NaNs? MEAN() simply calls
> MOMENT() so you could practice doing that yourself.
>
> Craig
Craig,
The obstacle is that the debug information IDL is providing gives me
nothing to go on about where to locate the /0. MEAN is called directly
in only about 20 places in the code I am looking to debug, but I
strongly suspect that some other IDL "builtins" call MEAN as well.
How can I get the stack trace of math errors, rather than just the
useless information that MEAN was called with a bad input?
--Edward H.
|
|
|
Re: Math errors tracked! To a built-in library... [message #78239 is a reply to message #78235] |
Wed, 02 November 2011 08:42  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Nov 1, 2:53 pm, Ed Hyer <ejh...@gmail.com> wrote:
> !except=2; blow up all math errors
> ...
> % Program caused arithmetic error: Floating divide by 0
> % Detected at MEAN 1 /usr/local/itt/idl71/lib/mean.pro
>
> If you understand why this gives me a sad, and you have any tips on
> finding the operation that tried to /0, please share.
Perhaps you are supplying an array with all NaNs? MEAN() simply calls
MOMENT() so you could practice doing that yourself.
Craig
|
|
|