This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Need some help here


On Thu, Nov 25, 2004 at 12:47:04AM -0800, Jerry DeLisle wrote:
> I can't get the attached program to work with double precision (kind=8).

I made some changes to your program which ought to make it work.

1) Use selected_real_kind to select the kind, since just specifying an
integer directly is not portable.

2) Move the function fn into the main program. Thanks to the explicit
interface I found a bug where you called fn with just 1 argument
instead of 2 (when calculating k3), likely the reason for the wrong
results. As to why it worked at all before, I have no idea.

3) Use implicit none, and declare all variables, including the return
type of the function fn.

4) Use wp kind for the constant "4.0" in fn instead of hardcoded kind.

Program attached. But really, this isn't the right forum for these
kinds of questions..



-- 
Janne Blomqvist

Attachment: rk4.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]