Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8834645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:04:20+00:00 2026-06-14T09:04:20+00:00

I’m trying to read a code written in Fortran 90. In the variable declaration

  • 0

I’m trying to read a code written in Fortran 90. In the variable declaration it has for example:

real(ra) :: X

I haven’t been able to find out what ra could refer to in this code. I thought it would be something like real(kind=8) Could someone explain this to me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:04:21+00:00Added an answer on June 14, 2026 at 9:04 am

    Yes

    real(ra) :: X
    

    is like

    real(kind=8)
    

    In fact it is the same thing if ra=8! The kind= is optional here.

    As to finding it ra will be a parameter. It may be in the same routine as the declaration above, it may be in a module used by the routine, or I suppose it might be in a file included in the routine. There may well be different options, but it will be in scope somehow.

    So why not use the second form? It is because the kind numbers are not portable and do vary from compiler to compiler – e.g.

    [luser@cromer stackoverflow]$ cat kind.f90 
    Program real_kinds
    
      Implicit None
    
      Real( 8 ) :: a
    
    End Program real_kinds
    [luser@cromer stackoverflow]$ gfortran kind.f90 
    [luser@cromer stackoverflow]$ nagfor kind.f90
    NAG Fortran Compiler Release 5.3.1 pre-release(904)
    Warning: kind.f90, line 7: Unused local variable A
    Error: kind.f90, line 5: KIND value (8) does not specify a valid representation method
    Errors in declarations, no further processing for REAL_KINDS
    [NAG Fortran Compiler error termination, 1 error, 1 warning]
    

    It is therefore better to use a parameter initialised with the selected_real_kind intrinsic to specify the kind:

    [luser@cromer stackoverflow]$ cat kind.f90 
    Program real_kinds
    
      Implicit None
    
      Integer, Parameter :: wp = Selected_real_kind( 12, 70 )
    
      Real( wp ) :: a
    
      Write( *, * ) Kind( a )
    
    End Program real_kinds
    [luser@cromer stackoverflow]$ gfortran kind.f90
    [luser@cromer stackoverflow]$ ./a.out
               8
    [luser@cromer stackoverflow]$ nagfor kind.f90
    NAG Fortran Compiler Release 5.3.1 pre-release(904)
    [NAG Fortran Compiler normal termination]
    [luser@cromer stackoverflow]$ ./a.out
     2
    

    will probably do what you want. A common alternative to selected_real_kind is

    Integer, Parameter :: wp = Kind( 1.0d0 )
    

    So in summary it is the same, just better in that if done carefully it is more portable.

    (and finally I really should say that kind values need have no relationship whatsoever to the number of bytes use to store the variable)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.