Eric Petersen asked:
> I have modified a code to use a varying step-size integrator (Watts &
> Shampine, rkf45.f, from netlib) in place of the fixed step-size Runge-Kutta
> method used previously. In the course of this work I modified a line
> in rkf45.f which reads (essentially)
>
> twoeps = 2. * d1mach(4) ! twoeps is set to twice the machine epsilon
>
> to
>
> twoeps = 2.D0 * epsilon(1.D0)
>
> The code seems to work fine, but I'm wondering whether this is really what
> the authors wanted, i.e., is d1mach(4) equivalent to epsilon(1.D0)?
Yes. d1mach(3) is epsilon()/radix(), i.e. the smallest relative difference
between consecutive representable numbers.
> And is
> the 2. instead of 2.D0 just a slip-up?
It doesn't matter. Fortran has well-specified rules for numeric type
conversion in expressions.
--
What fraction of Americans believe | Van Snyder
Wrestling is real and NASA is fake? | [log in to unmask]
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Dan Goldin, George Bush, the Pope, or anybody else.
|