- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Language Reference states that the argument type of INT is REAL(4); ie. in the A to Z Reference.
Does this apply even when kind = 8 is used with INT?
The following is a situation I have, which the compiler seems to accept (no the declarations are not done as '(8)' - just simplified to illustrate) :
[fortran]INTEGER(8) i8
REAL(8) r8
r8 = 1.234567890123456789d12
i8 = INT(r8,8)
[/fortran]
The Language Reference appears to say that r8 is not permissible in this situation?
However, it certainly compiles & from simple tests I have done, it appears to work; eg. in the above example the debugger reports i8 as having a value of 1234567890123.
My concern is that in some situation it might convert the r8 to a REAL & hence lose precision in i8.
Am I mis-interpreting the Language Reference?
Edit (multiple):
NB Having difficulty getting the code to display conrrectly ('insisted' on a blank line at the end, otherwise final statement is corrupted).
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're misreading the documentation, though I can understand the confusion. The table where the argument is described as REAL(4) is the "Specific Name" table. Otherwise, it's a generic and can accept any integer, real or complex kind.
The KIND argument specifies the kind of the result, not the argument. Your code is fine.
(Ignore the "REALREAL in the displayed formatted code - that will be fixed soon.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess it's possible to be confused by the presentation in ifort help file. At the top, it says that when the kind parameter is present, the following text and table don't apply. Then it goes on to discuss the specific, rather than the generic intrinsics, leaping past the distinction and failing to mention that INT itself is intrinsic and hides access to the specific INT.
Omission of the kind parameter doesn't restrict INT to REAL(4) argument. INT has been generic since F77. If you spelled it IFIX, it might be so restricted in some compilers, but the help file specifies that also is treated as generic by ifort. The F77 standard even recommended explicitly that IDINT no longer be used, that it should be replaced by INT.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page