Search the web
Sign In
New User? Sign Up
Fortran · Fortran Q/A's, info, lib and fans
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Querry...   Message List  
Reply | Forward Message #131 of 516 |
Re: Querry...

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.




Fri Aug 9, 2002 8:08 am

demiduet
Offline Offline

Forward
Message #131 of 516 |
Expand Messages Author Sort by Date

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 ...
junseok_74
Offline Send Email
Aug 9, 2002
3:14 am

Your program looks OK. Usually log(-ve) is undefined quantity. You make x +ve and then check. ... Result_________________________________________________ ... ...
Raj Gupta
rajgupta121
Offline Send Email
Aug 9, 2002
4:23 am

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...
demiduet
Offline
Aug 9, 2002
8:08 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help