This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, wwwdocs] gcc-4.3/changes.html: Fortran - Add GAMMA/LGAMMA


The following patch mentions GAMMA and LGAMMA as added GCC 4.3/Fortran
release notes.

There is a special reason for adding them besides that they a new
intrinsic procedues (which are, e.g., Fortran 2003's
IS_IOSTAT_END/IS_IOSTAT_EOR also). The reason is that GAMMA is a
not-uncommon name for a user procedure. Fortunately, the user's GAMMA is
often also the (true) Gamma function.

There is another problem with GAMMA: gfortran generates calls to
BUILT_IN_TGAMMA but this C99 function is not available in all C
libraries. (Or as with GLIBC, its implementation is exp(lgamma(x)) and
thus it is a bit inaccurate. [Some systems have a libc function "gamma"
which might be either lgamma or tgamma.])

Using
   x = gamma(4.0)
was regarded as user function by GCC < 4.3.0, but now it is regarded as
intrinsic function.

While
   external gamma
   x = gamma(4.0)
and
   intrinsic gamma
   x = gamma(4.0)
ensure that the right function is picked by the compiler.

OK for check in?

Tobias

--- htdocs/gcc-4.3/changes.html 30 Oct 2007 17:17:14 -0000      1.81
+++ htdocs/gcc-4.3/changes.html 30 Oct 2007 17:54:12 -0000
@@ -382,6 +382,13 @@
     <code>-finit-integer</code>, <code>-finit-character</code>, and
     <code>-finit-logical</code></a> options have been added, which can be
     used to initialize local variables.</li>
+    <li>The intrinsic procedures <a
+    href="http://gcc.gnu.org/onlinedocs/gfortran/GAMMA.html";><code>GAMMA
+    </code></a> and <a
+    href="http://gcc.gnu.org/onlinedocs/gfortran/LGAMMA.html";><code>LGAMMA
+    </code></a> have been added, which calculate the Gamma function and
+    its logarithm; use <code>EXTERNAL gamma</code> if you want to use your
+    own gamma function.</li>
     <li>Fortran 2003 support has been extended:
     <ul>
       <li>Intrinsic statements IMPORT, PROTECTED, VALUE and VOLATILE</li>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]