![]() ![]() ![]() Additional Support for Fortran Numeric Intrinsic Types If certain kind is not available in the compiler, the value returned by selected_real_kind() or the value of the integer constant is -1.Additional Support for Fortran Numeric Intrinsic Typesģ16. Integer, parameter :: quadruple_kind = real128 Integer, parameter :: double_kind = real64 Integer, parameter :: single_kind = real32 These constants provide real kinds with certain storage size in bits use ISO_Fortran_env Starting with Fortran 2008, pre-defined constants are available through the intrinsic module ISO_Fortran_env. Integer, parameter :: long_kind = c_long_double Integer, parameter :: double_kind = c_double Integer, parameter :: single_kind = c_float Starting with Fortran 2003, pre-defined constants are available through the intrinsic module ISO_C_Binding to ensure that real kinds are inter-operable with the types float, double or long_double of the accompanying C compiler: use ISO_C_Binding ![]() ![]() Integer, parameter :: double_kind = selected_real_kind( p=15, r=200 ) integer, parameter :: single_kind = selected_real_kind( p=6, r=37 ) The returned kind has precision of at least p digits and allows exponent of at least r. Using the intrinsic function selected_real_kind() to specify required decimal precision. Integer, parameter :: double_kind = kind(1.d0) Single (default) and double precision: integer, parameter :: single_kind = kind(1.) To inquire the kind of any real variable or constant, the function kind() can be used: print *, kind(1.0), kind(1.d0) The exact value of real_kind is not standardized and differs from compiler to compiler. This statement declares x to be of type real with a certain precision depending on the value of real_kind.įloating point literals can be declared with a specific kind using a suffix 1.23456e78_real_kind The kind of a real type is an integer named constant or literal constant: real(kind=real_kind) :: x ! Default single precision constantįortran 90 introduced parameterized real types using kinds. A real literal containing d instead of e for denoting the exponent is used to indicate double precision. Notice the d0 in the double precision constant. In common compilers using default configuration. In Fortran 2008, the decimal precision of y is at least 10 and its decimal exponent range at least 37. X here is a real of default kind and y is a real of kind with greater decimal precision than x. They can represent real numbers up to certain amount of decimal digits.įORTRAN 77 guaranteed two floating point types and more recent standards guarantee at least two real types. Floating point numbers of type real cannot have any real value. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |