×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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

type precedence protocol... gfortran

type precedence protocol... gfortran

type precedence protocol... gfortran

(OP)
i have read that when have mixed types such as integer and real in for example
r=a/i the result will be real*4
but now suppose have set
integer*8 a,r
then will
r=a/i be of precision real*8 or will it just be of default precision real*4 ?

RE: type precedence protocol... gfortran

What type is i?

RE: type precedence protocol... gfortran

(OP)
integer ofcourse by default

RE: type precedence protocol... gfortran

(OP)
or ok i see now why asked. I made an
error in that post. I meant to ask, say

have read that when have mixed types such as integer and real in for example
r=a/i the result will be real*4
but now suppose have set
REAL*8 a,r
then will
r=a/i be of precision real*8 or will it just be of default precision real*4 ?

RE: type precedence protocol... gfortran

Sorry about the delay in reply. Yes it will.

CODE

program main
    real*4 a4, r4
    real*8 a, r
    integer i
    a = 10.0
    a4 = 10.0
    i = 3
    r = a / i
    r4 = a4 / i
    print *, r4, a4
    print *, r, a
end 
These were the results with gfortran. You can always try it for yourself by writing a noddy program. Faster than waiting for an answer

3.33333325 10.0000000
3.3333333333333335 10.000000000000000

RE: type precedence protocol... gfortran

(OP)
yea i did try it in gfortran compiler and it did come out to real*8 so now i know
i will not have to go thru and put extra labels such as dble(...) but only in certain places where definitely needed

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