<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Its my mistake - the kind values are not defined, but using the intrinsics to select a kind value based on precision and/or range is well define.  My apologies for the confusion.<div><br></div><div>Bill</div><div><br><div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">William Gropp<br>Acting Director and Chief Scientist, NCSA</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Director, Parallel Computing Institute<br>Thomas M. Siebel Chair in Computer Science<br>University of Illinois Urbana-Champaign<br><br><br><br><br></div>
</div>
<br><div><div>On Sep 2, 2016, at 11:40 AM, Munson, Todd <<a href="mailto:tmunson@mcs.anl.gov">tmunson@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">

<div>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
I am confused by Blaise's statement.  "selected_real_kind(5)" is well defined across<br>
compilers; it returns an integer value that can be used in the kind statements and<br>
selected real numbers with at least 5 digits of precision.<br>
<br>
With the exception of -1, -2, and -3 (plus -4 and -5 in Fortran 2008) indicating <br>
no support.  The actual integer values returned are compiler specific.<br>
<br>
If we wanted to have a better chance of getting ieee single, double, and quad, <br>
we should probably use something like:<br>
<br>
  selected_real_kind(6,37)<br>
  selected_real_kind(15,307)<br>
  selected_real_kind(33,4931)<br>
<br>
in PETSc.  You would still need to do some testing during configuration to <br>
really ensure that<br>
<br>
  real(kind=selected_real_kind(7,38))<br>
  real(kind=selected_real_kind(15,307))<br>
  real(kind=selected_real_kind(34,4931))<br>
<br>
is the same as a C float, double, and __float128 respectively?  <br>
<br>
=====<br>
<br>
Its not until Fortran 2008 that the standard has constants for REAL32, REAL64, <br>
and REAL128 defined in the ISO_FORTRAN_ENV module.  However, if we are using<br>
Fortran 2008 features, go all out and use the ISO_C_BINDING module with <br>
the C_FLOAT and C_DOUBLE constants!  Some compilers, such as the gnu<br>
compilers. extend the constants and include C_FLOAT128.<br>
<br>
I have attached a simple program to output the kinds.  Try it on your machine.<br>
On my machine with gfortran from gcc version 4.8.5 (MacPorts gcc48 4.8.5_0), I<br>
get the following:<br>
<br>
 C_FLOAT   :            4<br>
 C_DOUBLE  :            8<br>
 C_FLOAT128:           16<br>
 REAL32    :            4<br>
 REAL64    :            8<br>
 REAL128   :           10<br>
 sel(6)    :            4<br>
 sel(15)   :            8<br>
 sel(16)   :           10<br>
 sel(33)   :           16<br>
<br>
The integers provide the number of bytes on my machine.  Note REAL128 is <br>
apparently an 80-bit long double and not a 128-bit __float128!!  The <br>
type using selected_real_kind appears correct though.  The same <br>
happens for REAL128 with gfortran from gcc 4.9.3, gcc 5.4.0, <br>
and gcc 6.1.0 on my machine.<br>
<br>
Todd.<br>
<br>
</div>
</span></font></div>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
<br>
> On Sep 2, 2016, at 12:51 AM, William Gropp <<a href="mailto:wgropp@illinois.edu">wgropp@illinois.edu</a>> wrote:<br>
> <br>
> This is true.  The meaning of integer values of kind is up to the implementation, and at least two choices are in use.<br>
> <br>
> Bill<br>
> <br>
> William Gropp<br>
> Acting Director and Chief Scientist, NCSA<br>
> Director, Parallel Computing Institute<br>
> Thomas M. Siebel Chair in Computer Science<br>
> University of Illinois Urbana-Champaign<br>
> <br>
> <br>
> <br>
> <br>
> <br>
> On Sep 1, 2016, at 6:15 PM, Blaise A Bourdin <<a href="mailto:bourdin@lsu.edu">bourdin@lsu.edu</a>> wrote:<br>
> <br>
>> If I recall correctly, fortran does not mandate that "selected_real_kind(5)" means the same across compilers, so that hardcoding kind values may not be portable.<br>
> <br>
<br>
</div>
</span></font></div>
</div>

<span><mytest.f></span></blockquote></div><br></div></body></html>