Arithmetic error [message #29108] |
Wed, 30 January 2002 16:31 |
Ed Wright
Messages: 39 Registered: February 1999
|
Member |
|
|
To: IDL
From: Ed Wright, JPL
I require assistance with an odd problem. My current projects involves
creating a dlm module of some 200+ routines from a library of 1500+
routines. Several of the IDL callable routines replicate intrinsic IDL
calls. While testing one such routine that calculates determinate of a 3X3 I
encountered a problem. The numerical result between my determinant function
and determn matches to 10^(-16).
Now the odd thing. Under certain circumstances the use of my determinant
function as an argument in another routine call causes an error:
% Program caused arithmetic error: Floating illegal operand.
Code causing error:
cspice_eul2m, 30.d0, 60.d0, -15.d0, 3, 2, 1, mat1
cspice_chcksd, "Determinant of rotation matrix", cspice_det(mat1), $
"~", 1.d0, LIMIT, ok
The first routine, cspice_eul2m, calculates a rotation matrix given the
rotation angles and the sequence of axes. The second routine, cspice_chcksd,
performs a tolerance test on the determinant of mat1, calculated by the
function cspice_det(mat1).
If I replace cspice_det(mat1) with determ(mat1), no error. If I recast the
code as:
cspice_eul2m, 30.d0, 60.d0, -15.d0, 3, 2, 1, mat1
det = cspice_det(mat1)
cspice_chcksd, "Determinant of rotation matrix", det , $
"~", 1.d0, LIMIT, ok
no error results.
Also, a different sequence of rotations exhibits no error. I have several
similar tests involving other matricies without error.
Any suggestions?
As always,
Ed Wright
JPL/NAIF
|
|
|