I am not sure whether I understand how ifort deals with different kinds of variable. What is the different between a real that uses kind(25,1000) and a real with kind(33)? When I see the outputs of range, precision, huge, tiny and kind, they seem to be the same for both variables. Why can't I define kind(40)? How to use a real with 16 bits?
Thanks fot the patience and help.
If you mean to ask about selected_real_kind, the subject is covered well in textbooks and compiler manuals.
Yes, there are only a few kinds supported by each compiler, so it should not be surprising if selected_real_kind(25,1000) turns out the same as selected_real_kind(33) (REAL128, the smallest kind which matches those parameters).
According to my reading of the ifort manual, there is no Fortran support for 16-bit real. In the Intel hardware which supports that format, expressions involving those numbers are evaluated using c_float (same as REAL32) and so could be saved as REAL32 or rounded off again to 16-bit real.
Tim is correct. SELECTED_REAL_KIND returns you the smallest kind number for a supported kind that meets the specified precision and range values, or a negative number if none do. Intel Fortran does not support 16-bit floats and has no plans to do so. (Nor does it support 80-bit floats.)