KIND declaration quirk in Fortran

Here’s another quirk I found about KIND declarations in Fortran. Here are two ways to declare the KIND of a variable:

COMPLEX*16 :: a

Here’s the interesting part: both of these variables have the same KIND! They are both ‘double precision’, generally using 8 bytes of storage for each of the real and imaginary parts of the number, or 16 bytes total. I say ‘generally’ because this can be compiler specific. Check out the module ISO_FORTRAN_ENV for more portability.

Update (2012-06-19): I learned why there is a difference here. It turns out that the declaration complex*16 is not part of any Fortran standard. Instead, it is a vendor extension that is supported by most, if not all, compilers today. So if you compile with strict standards-checking like gfortran -std=f2008, then you will receive an error. The correct way to write it is with complex(KIND=8).

Kepler Confirms First Planet in Habitable Zone of Sun-like Star

From NASA Science:

The newly confirmed planet, Kepler-22b, is about 2.4 times the radius of Earth. Scientists don’t yet know if Kepler-22b has a predominantly rocky, gaseous or liquid composition, but its discovery is a step closer to finding Earth-like planets.

This goes to show how we have so much more to learn about our universe. Astronomy is just one of the very exciting fields today.