Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Illegal FPO - power operation

Illegal FPO - power operation

Illegal FPO - power operation

Dear All,

I have a very basic question for you.

I got an illegal floating point operation executing an application (Abaqus) using a Fortran subroutine.

I wrote in my subroutine


   BB = -0.2447862
   AA = 0.6734121
   write (*,*) "BB,AA = ", BB,AA
   write (*,*) "-0.2447862**0.6734121 =
  * ",-0.2447862**0.6734121    
   write (*,*) "BB**AA = ", BB**AA


and I got

 BB, AA =  -0.244786270668933       0.673412181089838     
 -0.2447862**0.6734121 =  -0.3876160    

and then illegal FPO message.

I`m a beginner in using Fortran language, and I know this is a very basic problem, but I would be very thankful to u if u could help me.

Thanks in advance.



RE: Illegal FPO - power operation

I added some lines to your code


BB = -0.2447862
AA = 0.6734121
write (*,*) "BB,AA = ", BB, AA
write (*,*) "-0.2447862**0.6734121 =   * ",-0.2447862**0.6734121
write (*,*) "-(0.2447862)**0.6734121 =   * ",-(0.2447862)**0.6734121
write (*,*) "BB**AA = ", BB**AA
write (*,*) "(-0.2447862)**0.6734121 =   * ",(-0.2447862)**0.6734121
if I compile it with g77 I get


$ g77 alorenzom.for -o alorenzom -ffree-form

mikl1071@RMIKLOSXP ~/fortran
$ alorenzom
 BB,AA =  -0.244786203  0.673412085
 -0.2447862**0.6734121 =   *  -0.387616038
 -(0.2447862)**0.6734121 =   *  -0.387616038
 BB**AA =   -1.#IND
 (-0.2447862)**0.6734121 =   *   -1.#IND
You see, in the first case you compute -(0.2447862)**0.6734121 which gives you real result.
In the second case with BB**AA you try to compute
which could not be computed with real numbers - your variables AA and BB are implicitly real.  

RE: Illegal FPO - power operation

Thank u so much, mikrom.

Sorry... I didn`t realize that operation results in a complex number


a<0, b in R and b not in N, (a)**b in C

R real numbers
N natural numbers
C complex numbers

RE: Illegal FPO - power operation

Yes you get a complex number.
Here I computed in Python what result we get:


>>> bb = -0.2447862 + 0j
>>> aa = 0.6734121 + 0j
>>> bb**aa

RE: Illegal FPO - power operation

I wrote wrong in the previous post...


a<0, b in R and b not in Z, (a)**b in C

R real numbers
Z relative integer numbers
C complex numbers

RE: Illegal FPO - power operation

Hi both

Fortran can also real with complex numbers:


    program compl

    complex*16 aa,bb,cc

    bb = -0.2447862
    aa =  0.6734121


    write(1,'(a,2f12.7)') ' bb     =', bb
    write(1,'(a,2f12.7)') ' aa     =', aa

    cc = bb**aa

    write(1,'(a,2f19.14)') ' bb**aa =', cc

and the result is:


 bb     =   -.2447862    .0000000
 aa     =    .6734121    .0000000
 bb**aa =   -.20087759755167    .33150321627667

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close