distance between points on the earth (1) Using Double Precision for latitude and longitude and using double precision for degrees to radians and radius of the earth (by the way, I have seen values that differ by about 4 miles) (2) checking argument of acos to be between -1 and 1 Seems to be working OK. Are the generic sin,cos and acos functions... 24 Oct 2009 12:04
Integer return values in interfaces Returning to fortran usage after about 4 years, so my skills are a little rusty. Is the following construct legal: module mex implicit none integer, parameter :: mptr=selected_int_kind(9) interface integer(kind=mptr) function mexGetPr(pm) integer(kind=mptr) :: pm end function mexGetPr ... 12 Oct 2009 16:19
string stuff I have config files with lines that look as follows: on 0.2 0.2 0.02 0.02 0.01 0.01 pulse 5.0e8 100e3 The number of spaces between items is arbitrary, and the number formatting is also arbitrarily chosen by the user. The number of numbers after 'pulse' can vary. I read this as: character(len=100) :... 28 Oct 2009 06:15
Namelist/module-question Hi! I try to add namelist-functionality to some Fortran-code. At first I only want to read in a yes/no switch. use_GII=true/false. The program consists of several subroutines. As far as I see I have to make the logical variable use_GII known to the subroutines. There's already a source-file "RTsettings.f90... 5 Oct 2009 12:22
Renaming module procedures Hi, Within the same module, how do you rename module procedures that are called by other module procedures? It sounds confusing... I'll explain better. When I call a module from an external procedure, I know I can rename the internal procedures contained in that module in the following way: module mod priv... 1 Oct 2009 00:39
ENTRY statement The following program causes a segmentation fault after the first print with every compiler I tried. I presume it is not standard- conforming but I don't understand why. I thought an ENTRY statement was allowed to specify a dummy variable of type a different from the one in the SUBROUTINE statement. progra... 10 Oct 2009 02:58
Passing optional parameters Dear all, Find below a piece of code that gives a run-time error with the ifort compiler. I thought this to be legal code, but maybe I am overlooking something. Thanks in advance, Arno =========================== file 1 (main.f90) program main use my_module call wrapper() end program main ==... 29 Sep 2009 11:51
IMSL, NAG Fortran Library vs. Open Source libraries Hello, I recently got asked the question again whether the NAG Fortran Library was available on our server. In the past, I already got the same question about the IMSL library... There is one problem for me to answer that question: I like Open Source Software... So I would like to advise the persons asking... 19 Sep 2009 11:28
INTRINSIC STATEMENT for functions overloaded for user defined types I am wondering what INTRINSIC statement does for us. such as INTRINSIC SIN, COS, ABS It seems gfortran and CVF treat this statement differently. For a code containing three files: test1.f90 PROGRAM Main USE TEST TYPE (DN)::DX DX=DN(1.0D0,1.0D0) write(*,*) SIN(DX) END PROGRAM Main DNAD.f90 MODULE... 20 Sep 2009 18:29
reading config file Hello all, After switching jobs and now mainly being programming in Octave, it is nice to be back for asking yet another questions here to good old clf :-) I would like to read a configuration file that could look like this: nb_apples 3 my_weight 68.5 elephant_weight 4.6e3 smoking_allowed tru... 25 Sep 2009 15:17 |