How to declare real constants in Fortran? Please help

  • Context: Fortran 
  • Thread starter Thread starter onlybarca6
  • Start date Start date
  • Tags Tags
    Constants Fortran
Click For Summary
SUMMARY

To declare real constants in Fortran that output values beginning with zero, use the REAL, PARAMETER statement along with FORMAT descriptors for proper formatting. For example, declaring REAL, PARAMETER :: tension = 0.025 results in scientific notation output. To achieve a standard decimal format, utilize FORMAT statements to control the display of the constant.

PREREQUISITES
  • Understanding of Fortran syntax and data types
  • Familiarity with REAL and PARAMETER declarations in Fortran
  • Knowledge of FORMAT descriptors in Fortran
  • Basic principles of numerical representation in programming
NEXT STEPS
  • Research Fortran FORMAT statement options for controlling output
  • Explore examples of REAL constant declarations in Fortran
  • Learn about scientific notation versus decimal representation in Fortran
  • Investigate best practices for numerical formatting in Fortran programming
USEFUL FOR

This discussion is beneficial for Fortran programmers, educators teaching numerical methods, and anyone looking to format output in scientific computing applications.

onlybarca6
Messages
5
Reaction score
0
How do I declare constants beginning with "zero" in Fortran to get the output beginning with zero ?

If I declare :

REAL, parameter :: tension = 0.025

I get the output:

2.500000E-02



Thanks in advance
 
Technology news on Phys.org
I think you want to look at FORMAT descriptors.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 17 ·
Replies
17
Views
5K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 12 ·
Replies
12
Views
3K