Questions tagged [fortran95]

Fortran 95 is a minor revision, mostly to resolve some outstanding issues from the Fortran 90 standard. Its successor is Fortran 2003 which is widely implemented in modern compilers. Questions using this tag should be specific to the language defined as Fortran 95, rather than being more general Fortran questions. Such questions should also have the Fortran tag.

This minor revision of added some new features to its predecessor, .

352 questions
29
votes
8 answers

Is there a standard way to check for Infinite and NaN in Fortran 90/95?

I've been trying to find a standards-compliant way to check for Infinite and NaN values in Fortran 90/95 but it proved harder than I thought. I tried to manually create Inf and NaN variables using the binary representation described in IEEE 754,…
astrojuanlu
  • 6,744
  • 8
  • 45
  • 105
26
votes
2 answers

Proper use of the PURE keyword Fortran

I'm currently delving into Fortran and I've come across the pure keyword specifying functions/subroutines that have no side effects. I have a book, Fortran 90/95 by S Chapman which introduces the pure keyword but strangely provides no "good coding…
River
  • 8,585
  • 14
  • 54
  • 67
17
votes
1 answer

What is the purpose of result variables in Fortran?

In Fortran, there are two standard ways to return a result from a function. The first one is by assigning the return value of the function to the function name. function foo() integer :: foo foo = 10 end function foo The second form,…
16
votes
4 answers

Reading a character string of unknown length

I have been tasked with writing a Fortran 95 program that will read character input from a file, and then (to start with) simply spit it back out again. The tricky part is that these lines of input are of varying length (no maximum length given) and…
user2053072
16
votes
1 answer

Fortran 90/95 library for sparse matrices?

I am looking for a library for dealing with sparse matrices in fortran 90/95. I only need very basic operations like matrix-vector multiplication. What do you suggest I use? I have searched around and an extension(?) to BLAS called "sparse blas",…
arne
  • 677
  • 1
  • 6
  • 14
16
votes
1 answer

Current best method for wrapping Modern Fortran code with Python

I know of, and have used f2py2e to wrap some old Fortran 77 code, but my understanding is that it does not work with newer Fortran 95 code. I've researched what I should use, and have come across fwrap and G3 f2py, neither of which seem to give any…
James Tocknell
  • 494
  • 5
  • 15
13
votes
2 answers

Fortran forall restrictions

I tried to use forall to allocate dynamic arrays, but gfortran didn't like that. I also found out that write statements are forbidden in a forall block ,and I suspect read statements are too. What other functions/operations are not permitted in a…
Samuel Tan
  • 1,700
  • 5
  • 22
  • 35
13
votes
2 answers

getting free unit number in fortran

I need to develop a library that opens a file and parses the stuff. The unit number, due to fortran IO style, must be decided by me, but I can't know what other units are open in the client code. Is there a standard function like…
Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
13
votes
2 answers

How to remove leading space when printing with write?

Suppose I have the following code program fortran open(900, FILE='SOMETHING') write(900, *) '21' end program fortran The file form will be 21 that is, there is a space before the number. How to get rid of that space?
user3892863
  • 161
  • 1
  • 1
  • 3
12
votes
2 answers

Fortran: the largest and the smallest integer

Fortran is completely new for me, can anybody help me to solve the follwing problem? I want to find out all the integer kind numbers and the largest and the smallest value for each kind number on my pc. I have code listed below: program…
echo
  • 167
  • 1
  • 1
  • 12
11
votes
2 answers

Line truncated, Syntax error in argument list

When I compile the program below, I have an error and a warning in the call Coor_Trans command line as Warning: Line truncated Error: Syntax error in argument list I compile the program several times, but it does not work. Maybe there is something…
Jeremy_Tamu
  • 725
  • 1
  • 8
  • 21
9
votes
2 answers

I/O in pure Fortran procedures

I'm trying to incorporate error checking within a pure procedure I am writing. I would like something like: pure real function func1(output_unit,a) implicit none integer :: a, output_unit if (a < 0) then write(output_unit,*)…
Samuel Tan
  • 1,700
  • 5
  • 22
  • 35
9
votes
3 answers

Is Fortran return statement obsolete?

I just want to know if the return statement in Fortran 2008 is obsolete, because it seems to be unnecessary to write it at the end of subroutines and functions. Does it have some other utility?
rsaavedra
  • 378
  • 1
  • 4
  • 12
9
votes
1 answer

Smart printing of integers in fortran90

I'm learning Fortran90 after a brief introduction to Fortran77 a few years ago. When printing integers in Fortran, you must specify how many spaces you want to reserve for printing the integer. Consider this program... implicit none integer :: i i…
Daniel Standage
  • 8,136
  • 19
  • 69
  • 116
8
votes
2 answers

In fortran how to read all strings line by line from a .dat file in fortran

I have a .dat file , from which I am trying to read line by line and print it. Can anyone please help about how to do it in fortran? Thanks in advance! Data: REMARK GENERATED BY TRJCONV TITLE UNNAMED t= 0.00000 REMARK THIS IS A…
Samudranil Roy
  • 211
  • 1
  • 4
  • 14
1
2 3
23 24