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

  • Home
  • SEARCH
  • 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 8386759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:01:43+00:00 2026-06-09T18:01:43+00:00

I am using gfortran 4.7.1 on Mac OS X 10.8 to compile a simple

  • 0

I am using gfortran 4.7.1 on Mac OS X 10.8 to compile a simple program using a specific precision:

program simple
  implicit none
  integer, parameter :: l = selected_real_kind(18,100)
  real(kind=l) :: myNum
  myNum = 0.123456789123456789
  print '(f18.12)', myNum
end program simple

When I compile and run I get 0.123456791043 which obviously indicates I’m not getting the precision I called for.

However if I compile with -fdefault-real-8 I get the right answer. Obviously, I could just move on and use the option, but I can’t help wondering whether this is a bug or I am missing some justification. Do I really have to specify my real size outside of the code itself when it seems that selected_real_kind intent is to allow the code to specify precision?

  • 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-09T18:01:44+00:00Added an answer on June 9, 2026 at 6:01 pm

    Sorry. You have to add _l to the number assignment.

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

Sidebar

Related Questions

In trying to mix precision in a simple program - using both real and
Here is my minimal example: program test implicit none real :: testfunc write(*,*) Writing
I am using gfortran to compile FORTRAN 77 and would like to have DEBUG
I'm getting the following errors trying to compile a project: (fortran, using gfortran) undefined
In Fortran 90 (using gfortran on Mac OS X) if I assign a value
The situation is simple, but strange. When i compile my program without the LinearAlgebra.o
I am using Intel's FORTRAN compiler to compile a numerical library. The test case
When writing and calling pure subroutines in Fortran 90 using gfortran, how do I
using System; f.involk() failed since it needs a string parameter, how to correct the
I made a simple fortran routine subroutine add(x,y) real(8) :: x,y y = x

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.