Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Declare constant function arguments with specific data type

fobermaier
Beginner
314 Views
Hello,

I have a function with the following interface:

[plain]integer(4), parameter :: real_kind = 8
subroutine SetZWidS( linkIndex, segmentIndex, value ) integer(4), intent(in) :: linkIndex, segmentIndex real(real_kind), intent(in) :: value ... end subroutine [/plain]

If I want to pass 1.0E30 for value, e.g.
[cpp]call SetZWidS(link, segement, 1.0E30),[/cpp]

I get an error that data types are inconsistent.
Is there a way to declare the 1.0E30 as double without using dble or real(val, 8)?
If so, does that work for other numeric data types as well?

Thanks in advance
FObermaier
0 Kudos
1 Solution
Les_Neilson
Valued Contributor II
314 Views

You could use 1.0e30_8 or 1.0e30_real_kind if real_kind is visible in the calling routine (advisable)

Les

View solution in original post

0 Kudos
1 Reply
Les_Neilson
Valued Contributor II
315 Views

You could use 1.0e30_8 or 1.0e30_real_kind if real_kind is visible in the calling routine (advisable)

Les
0 Kudos
Reply