Robert Kernell wrote:
>
> Hi. I am teaching a Fortran class and I was wondering...
>
> Is there any use for specifying kinds for constants?
>
> Bob Kernell
> Research Scientist
> Surface Validation Group
> Atmospheric Sciences Competency
> Analytical Services & Materials, Inc.
> email: [log in to unmask]
> tel: 757-827-4631
integer, parameter :: my_kind = selected_real_kind(13)
1. To make sure argument types match.
call a_subroutine(1.0_my_kind)
2. To get the precision you think you are getting:
real, parameter :: pi = 3.141591111111_my_kind
(The digits of pi really are not 1s 8^).
3. Similar to (2)
area = r**2 * 3.141591111111_my_kind
Of course, the better way is to use a parameter.
--
Walt Brainerd [log in to unmask]
Unicomp, Inc. +1-520-298-7212 298-7074 (fax)
7660 E. Broadway, Suite 308 888-330-6060
Tucson, AZ 85710 USA http://www.uni-comp.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|