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 7851165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:06:07+00:00 2026-06-02T19:06:07+00:00

INTEGER, PARAMETER :: SINGLE=SELECTED_REAL_KIND(7) REAL(KIND=SINGLE) :: K REAL::X … K=X WRITE(*,*) K When i

  • 0
INTEGER, PARAMETER :: SINGLE=SELECTED_REAL_KIND(7)
REAL(KIND=SINGLE) :: K
REAL::X
...
K=X
WRITE(*,*) K

When i write 5 or 6 inside SELECTED_REAL_KIND, it outputs six significant figures but when i try 7, it outputs more than 7. Can you tell me why? Where i got it wrong? Assigning is problematic?

With 5 and 6 output-> 1.39256

With 7 output-> 1.3925623893

Okey I’m asking a simple question. How can i just output 7 significant digits of this number 1.3925623893
?

  • 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-02T19:06:08+00:00Added an answer on June 2, 2026 at 7:06 pm

    From gfortran’s documentation:

    SELECTED_REAL_KIND(P,R) returns the kind value of a real data type with decimal precision of at least P digits

    The at least is important. Floating point numbers are most of the time stored using 4 bytes (single precision) or 8 bytes (double precision) and that’s it. That’s going from asking 6 to 7 significant figures actually adds even more figures: you switched from single to double precision.

    What you really want is have a real large enough to store the precision you want, and you already did that correctly, then display only 7 significant figures using a format like:

    write(*,'(F12.7)') K
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MustInherit .NET class which declares a constructor with an integer parameter.
I want to send an integer as a parameter to the system() function in
The following returns whatever integer I feed it as a parameter. def space(spacer_count) spacer_count.times
Is there any compiler that has a directive or a parameter to cast integer
In VB.NET, it is entirely possible to pass an integer as a string parameter
This is probably a real simple question but I'm looking for the most memory
I have a template function where the template parameter is an integer. In my
I have a homework. The question is: Write a function that takes as parameter
I am trying to write a select query from one single table in SQLite
I have a class that currently has several methods that take integer parameters. These

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.