|
|
Up |
|
|
  |
Author: wimwim Date: Aug 26, 2008 02:45
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
|
| Show full article (0.63Kb) |
|
| | 26 Comments |
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: Aug 26, 2008 12:06
wim wrote:
(I wrote)
>>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.
|
| Show full article (1.00Kb) |
|
| | no comments |
|
  |
Author: wimwim Date: Aug 26, 2008 12:07
On Aug 26, 9:06Â pm, glen herrmannsfeldt ugcs.caltech.edu> wrote:
> wim wrote:
>
> (I wrote)
>
>
>
>
>
>>>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 ...
|
| Show full article (1.36Kb) |
| 1 Comment |
|
  |
|
|
  |
Author: Ron ShepardRon Shepard Date: Aug 26, 2008 18:34
In article <1ekmpg9sbb6l6.dlg@example.invalid>,
Ron Ford wrote:
>
> 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?
I don't understand the above sequence of sentences.
selected_int_kind(13) does what you want in a portable way, provided
the compiler supports an integer that long. If your compiler does
not support integers with 13 digits, then what you want to do is not
portable to that compiler.
|
| Show full article (1.09Kb) |
| no comments |
|
  |
Author: Ron FordRon Ford Date: Aug 26, 2008 18:51
On Tue, 26 Aug 2008 20:34:34 -0500, Ron Shepard posted:
> In article <1ekmpg9sbb6l6.dlg@example.invalid>,
> Ron Ford wrote:
>
>>
>> Don't I need to wrtie an executable staement to figure this out, such as:
>> mp =selected_int_kind(13...
|
| Show full article (2.67Kb) |
| 1 Comment |
|
  |
Author: Ron ShepardRon Shepard Date: Aug 26, 2008 19:51
In article <19u1j7r8by3vv.dlg@example.invalid>,
Ron Ford wrote:
> I think this is a counterexample to the notion that 4 might be the default
> int for conforming implementations.
Yes, integer kind 4 is definitely not specified by the fortran
standard in any way, it is not even required to correspond to any
integer kind at all. That is what the selected_xxx_kind()
intrinsics are for.
$.02 -Ron Shepard
|
| |
| no comments |
|
  |
Author: nospamnospam Date: Aug 26, 2008 19:54
Ron Ford wrote:
> I think this is a counterexample to the notion that 4 might be the default
> int for conforming implementations.
Like Ron Shepard, I sometimes have trouble parsing the English in your
postings, before one even gets into questions of Fortran. I don't know
what the above is supposed to mean. If it is supposed to mean anything
close to what it sounds like, then it is obviously false (obviously
enough so that it makes me suspicious that I misunderstood the meaning).
You can't disprove a claim that something might be so in some cases by
giving a counterexample showing that it isn't so in some other case.
There's probably a name for that kind of logical falacy. Somewhat like
me saying that my pet is a dog and you saying that can't be so because
your pet is a cat.
I'm also don't know for sure what you mean by "4 might be the default
int". I could guess, but it is frankly too much bother to try to verify
the guess. I suppose you are talking about the kind value for default
integer, but maybe you are talking about the size in bytes (sometimes,
but not always the same thing), or the number of decimal digits, or...
|
| Show full article (1.36Kb) |
| no comments |
|
  |
Author: Ron FordRon Ford Date: Aug 26, 2008 20:28
On Tue, 26 Aug 2008 19:54:38 -0700, Richard Maine posted:
> Ron Ford wrote:
>
>> I think this is a counterexample to the notion that 4 might be the default
>> int for conforming implementations.
>
> Like Ron Shepard, I sometimes have trouble...
|
| Show full article (1.74Kb) |
| no comments |
|
  |
|
|
  |
Author: nospamnospam Date: Aug 27, 2008 00:40
Ron Ford wrote:
> Had you read the thread more carefully, you may have seen the motivation to
> posit that '4' was special,
Possibly, but when it is hard for me to read the single sentences,
reading the whole thread carefully is too much. I tend to not bother to
try very hard. In any case, I wasn't asking about the motivation of the
question, but rather about what the question actually was, which this
didn't clarify. But anyway...
> qsort is in C's stdlib; can fortran make the necessary interface?
I haven't looked at the interface to qsort. Being in stdlib is
irrelevant to the question. Knowing what the interface actually is would
be a lot more relevant.
|
| Show full article (1.89Kb) |
| no comments |
|
|
|
|