PDA

View Full Version : error for LOG


aznan
03-12-2009, 09:11 AM
Hi, when i run the program, an error appear at the command prompt:

In DLOG(dx) or LOG(dx) or DLOG10(dx) or LOG10(dx) or DLOG2(dx) or LOG2(dx), dx.l

e.0.0 (dx=nan).

Error occurs at or near line 1691 of _ljccal_

Called from or near line 81 of _MAIN__

Program Completed

Press Enter to Continue.

_________________
the program in line 1691:

DO 10 I=1,IS

IF (P(I).GT.N(I)) THEN

CR(I)=P(I)+ND(I)-N(I)

ELSE IF (P(I).LT.N(I)) THEN

CR(I)=-N(I)+ND(I)+P(I)

END IF

LP(I)=V(I)+DLOG(ABS(P(I)/NI))*S1

LN(I)=V(I)-DLOG(ABS(N(I)/NI))*S1

10 CONTINUE


Thanks & Regards,

Ainon

tzeis
03-14-2009, 01:04 AM
You will have to do some investigation to find out what is wrong, and the crash at the DLOG function is the symptom, the problem happens somewhere before that line of code.
The error message indicates that something is wrong with the argument to the LOG function, and that the argument is NaN (not a number).
This means that some kind of math error happened when calculating either P(I) or NI. Some errors that can cause a NaN are things like dividing zero by zero or taking the log of a negative number.