Re: busting sp datatypes



On Tue, 26 Aug 2008 02:45:44 -0700 (PDT), wim posted:

glen herrmannsfeldt wrote:

(snip)

KIND(0) will be the appropriate KIND for default
(single precision) integer. (Though integer data is
not usually described as single and double precision.)

There may not be a standard way to generate a double
length integer variable.

what about using selected_int_kind?

$ cat int.f90
program int
implicit none
integer :: i
do i = 1,20
print *, i, selected_int_kind(i)
end do
end program int

This should show you what you need for a double length integer.
Here, it gives: 1,2,4, and 8. 4 is the one you get with a default
integer.

Thanks, wim, I did this recently without thinking that I needed biggish
integers, so didn't pay too much attention. For my machine, this output
is:
1 1
2 1
3 2
4 2
5 3
6 3
7 3
8 3
9 3
10 4
11 4
12 4
13 4
14 4
15 4
16 4
17 4
18 4
19 -1
20 -1

Press RETURN to close window . . .

Is 4 my default as well? It's confusing, because 4 could mean different
things here.

I'm stumbling on the implementation, as it is different than for reals.


Don't I need to wrtie an executable staement to figure this out, such as:
mp =selected_int_kind(13)


If I execute a statement, I can't thereafter declare:
integer (kind=mp) :: anything

Does anyone know a portable way to declare, populate and print an integer
with thirteen digits?
--
Wealth - any income that is at least one hundred dollars more a year than
the income of one's wife's sister's husband. 6
H. L. Mencken
.