- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello
Is there any counterpart to the Fortran functions MAX,MIN,ABS,MOD which would return a long integer (integer(8)) number upon return
Thanks
Adam
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Do you mean the non-standard Fortran 66 style extensions like kmax0 documented in Intel Fortran User and Reference Guide? They don't extend the language beyond Fortran 90, where all f77 standard generic intrinsics work with integer(selected_real_kind(12)) (or Fortran 2008 kind=int64). These intrinsics return the same kind as their argument, regardless of whether you use the standard generic intrinsic or the non-standard "specific" one.
Intrinsics like kmax0 are vendor-specific extensions supplied only to make certain legacy applications work without source code edits. They are so rarely used that there seems little point in trying to find out which of them work with a given compiler.
If you intend to use them as "actual arguments" that might be a different story, but such usage with non-standard specific intrinsics is so rare that I wouldn't have any expectation of them working in general, even with a restriction to a certain vendor's compilers.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
No I was thinking of using standard functions. I see that for SIZE, UBOUND and INT function one can specify KIND parameter, I have not seen such and option for MAX, MIN, ABS, MOD and COUNT and I did not know that in Fortran 2008 it returns kind=int64 type.
Thanks
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Generally the generic intrinsics return the same type and kind as the argument(s). SIZE, UBOUND and INT always return integers no matter what type or kind their arguments are. Previously they always returned default integer, so we added KIND= to allow you to specify the kind you got back.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
A minor correction - INT always had KIND= - indeed, this is the way you could convert from one kind to the other. My comments about SIZE, UBOUND and other "inquiry" intrinsics holds. And while Intel Fortran did add KIND= to some of these earlier, by "we" I meant the Fortran standards committee.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
That would be a violation of the standard, which requires that all the arguments have the same type and type parameters. An implementation may choose to allow this mismatch as an extension (we do).
