You can't take the logarithm of a negative number using REAL or
DOUBLE PRECISION arithmetic. It doesn't exist.You can take the
logarithm of a negative quantity using COMPLEX arithmetic because
it has an imaginary part.
If you are curious, try changing DOUBLE PRECISION to COMPLEX X,Y.
Depending on your compiler, change DEXP and DLOG to either EXP and LOG
or CEXP and CLOG. (Some compilers let you use EXP and LOG for all
varieties of real and complex variables.)
In complex arithmetic, log(-8**(1/3)) = log (-2) = log(2) + i*pi
(where i = sqrt(-1) and pi is the familiar constant 3.14159...)
--- In fortran@y..., "junseok_74" <junseok_74@y...> wrote:
> Hello, I have some problem. Please have a look at and give me some
> advices...
> Thanks.
>
>
> Source code---------------------------
>
> DOUBLE PRECISION X,Y
> X=-8.D0
> Y=1.D0/3.D0
> WRITE (*,*) 'The value of X**Y=',DEXP(Y*DLOG(X))
> END
>
> Result_________________________________________________
>
> run-time error M6201: MATH
> - log: DOMAIN error
> Image PC Routine Line Source
> Text1.exe 004076B9 Unknown Unknown Unknown
> Text1.exe 004074D1 Unknown Unknown Unknown
> Text1.exe 00407671 Unknown Unknown Unknown
> Text1.exe 00409908 Unknown Unknown Unknown
> Text1.exe 004261D0 Unknown Unknown Unknown
> Text1.exe 00423C2A Unknown Unknown Unknown
> Text1.exe 004010A3 Unknown Unknown Unknown
> Text1.exe 0042EEB9 Unknown Unknown Unknown
> Text1.exe 00422E74 Unknown Unknown Unknown
> KERNEL32.dll 77E692A6 Unknown Unknown Unknown
>
> Incrementally linked image--PC correlation disabled.