public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32980]  New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
@ 2007-08-03 20:17 burnus at gcc dot gnu dot org
  2007-08-04 17:53 ` [Bug fortran/32980] " fxcoudert at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-03 20:17 UTC (permalink / raw)
  To: gcc-bugs

It would be useful if gfortran could implement the following two intrinsics:

a) The Gamma function GAMMA, specific name DGAMMA
b) The logarithm of the Gamma function LGAMMA, specific names ALGAMA, DLGAMA

They are supported by a couple of compilers such as g95, xlf95.

It would be nice if the manual could contain also the definition (integral).

http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.xlf81m.doc/pgs/lr232.htm
http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.xlf81m.doc/pgs/lr256.htm


-- 
           Summary: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA
                    (ALGAMA/DLGAMA)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
@ 2007-08-04 17:53 ` fxcoudert at gcc dot gnu dot org
  2007-08-04 19:33 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-04 17:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-08-04 17:53 -------
Aren't they included in the current F2008, by any chance?


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-08-04 17:53:03
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
  2007-08-04 17:53 ` [Bug fortran/32980] " fxcoudert at gcc dot gnu dot org
@ 2007-08-04 19:33 ` burnus at gcc dot gnu dot org
  2007-08-21 17:06 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-04 19:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-08-04 19:32 -------
> Aren't they included in the current F2008, by any chance?
Yes and no. The Fortran 2008 draft has the following functions, but they are
not necessarily called the same as the typical vendor extensions.
http://j3-fortran.org/doc/year/07/07-007r2.pdf

ACOSH, ASINH, ATANH Inverse hyperbolic functions  [exist in gfortran]
BESSEL_J0, _J1, _JN, _Y0, _Y1, _YN  Bessel functions [exist as BESJ0 etc.]
ERF   Error function [exists]
ERFC  Complementary error function [exists]
ERFC_SCALED Exponentially scaled ERFC [not in gfortran]
GAMMA Gamma function [not in gfortran ;-)]
HYPOT = sqrt(x**2+y**2) [not in gfortran]
LOG_GAMMA [not in gfortran ;-)]
NORM2  L_2 norm [not in gfortran]

No specific names seems to exist for those whereas the compiler extensions
have:
for GAMMA: DGAMMA and for LGAMMA [F2003: LOG_GAMMA]: ALGAMA, DLGAMA.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
  2007-08-04 17:53 ` [Bug fortran/32980] " fxcoudert at gcc dot gnu dot org
  2007-08-04 19:33 ` burnus at gcc dot gnu dot org
@ 2007-08-21 17:06 ` burnus at gcc dot gnu dot org
  2007-08-21 17:08 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-21 17:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-08-21 17:06 -------
Created an attachment (id=14090)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14090&action=view)
invoke.texi patch

Note: I did not mention "Fortran 2008" and I also did not include "LOG_GAMMA"
(F2008 name of "LGAMMA").

LGAMMA: lgamma,lgammaf,lgammal are part of C99.
GAMMA: "gamma" is a vendor extension, but C99 has the "true Gamma function":
tgamma, tgammaf, tgammal.
(Contrary to Fortran, C allows all values but returns NaN (neg.int.) or +/-INF
(+/-0) for values excluded in Fortran.)

As the functions are part of C99, gcc offers these as BUILD_IN_*.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-08-21 17:06 ` burnus at gcc dot gnu dot org
@ 2007-08-21 17:08 ` burnus at gcc dot gnu dot org
  2007-08-21 17:42 ` fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-21 17:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2007-08-21 17:08 -------
Created an attachment (id=14091)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14091&action=view)
invoke.texi patch

Note: I did not mention "Fortran 2008" and I also did not include "LOG_GAMMA"
(F2008 name of "LGAMMA").

LGAMMA: lgamma,lgammaf,lgammal are part of C99.
GAMMA: "gamma" is a vendor extension, but C99 has the "true Gamma function":
tgamma, tgammaf, tgammal.
(Contrary to Fortran, C allows all values but returns NaN (neg.int.) or +/-INF
(+/-0) for values excluded in Fortran.)

As the functions are part of C99, gcc offers these as BUILD_IN_*.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-08-21 17:08 ` burnus at gcc dot gnu dot org
@ 2007-08-21 17:42 ` fxcoudert at gcc dot gnu dot org
  2007-08-21 17:52 ` fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-21 17:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-08-21 17:42 -------
Few comments:

* F2008 draft says: "The intrinsic function ATAN is extended so that ATAN (Y,
X) is ATAN2 (Y,X)." We'll need to take care of that too.

* Will we want a -std=f2008 separate from f2003, or do we consider f2003 an
alias for f2008 (F2008 being, after all, a minor improvement to F2003)?

* scaled-erfc will require a library implementation, because it's not widely
available on systems out there


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-08-21 17:42 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-21 17:52 ` fxcoudert at gcc dot gnu dot org
  2007-08-21 19:05 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-21 17:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-08-21 17:52 -------
(In reply to comment #5)
> * scaled-erfc will require a library implementation, because it's not widely
> available on systems out there

I should have added this link: http://www.netlib.org/specfun/erf


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-08-21 17:52 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-21 19:05 ` burnus at gcc dot gnu dot org
  2007-08-21 19:06 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-21 19:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from burnus at gcc dot gnu dot org  2007-08-21 19:04 -------
> * Will we want a -std=f2008 separate from f2003, or do we consider f2003 an
> alias for f2008 (F2008 being, after all, a minor improvement to F2003)?

Who said that it will be a minor change compared to Fortran 2003 [except that
it was supposed to be one]? With Co-Arrays and submodules and a couple of other
changes I wouldn't claim so. I'm definitely in favour of having -std=f2008,
however, I'm not sure it is already time to introduce such features. (I need
the vendor intrinsic GAMMA which I want to be compatible to Fortran 2008;
currently I don't care of Fortran 2008 nor do I want to promote it, yet.)

The current time line of Fortran 2008 is:
2007-12 First working draft available
2008-02 WG5 review of working draft
2008-04 WG5 approval of draft CD [...]
2009-07 Final CD submitted for approval

I think we should wait at least for the first working draft until we start with
-std=f2008. Only shortly ago (2007-08-13), the BITS type and the macros were
(fortunately) dropped which shows that things are still in a flux -- not that I
expect LOG_GAMMA and GAMMA to change/disappear esp. as they are compatible with
C. The other mentioned intrinsic changes are also unlikely to change [better
ask Toon before adding].

We already have a F2008 feature: We allow "CONTAINS" followed by no contained
procedure. When we introduce STD_F2008, one should change the error message
there.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-08-21 19:05 ` burnus at gcc dot gnu dot org
@ 2007-08-21 19:06 ` patchapp at dberlin dot org
  2007-08-26 18:12 ` burnus at gcc dot gnu dot org
  2007-08-26 18:26 ` burnus at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2007-08-21 19:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from patchapp at dberlin dot org  2007-08-21 19:06 -------
Subject: Bug number PR32980

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01386.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-08-21 19:06 ` patchapp at dberlin dot org
@ 2007-08-26 18:12 ` burnus at gcc dot gnu dot org
  2007-08-26 18:26 ` burnus at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-26 18:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from burnus at gcc dot gnu dot org  2007-08-26 18:11 -------
Subject: Bug 32980

Author: burnus
Date: Sun Aug 26 18:11:42 2007
New Revision: 127809

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127809
Log:
2007-08-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/32980
        * intrinsic.h (gfc_simplify_gamma,gfc_simplify_lgamma,
        gfc_resolve_gamma,gfc_resolve_lgamma): New function declations.
        * mathbuiltins.def: Define GAMMA and LGAMMA.
        * intrinsic.c (add_functions): Add GAMMA, DGAMMA, LGAMMA, ALGAMA
        and DLGAMA.
        * simplify.c (gfc_simplify_gamma,gfc_simplify_lgamma): New functions.
        * iresolve.c (gfc_resolve_gamma,gfc_resolve_lgamma): New functions.
        * intrinsic.texi: Add documentation for GAMMA and LGAMMA.

2007-08-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/32980
        * gfortran.dg/gamma_1.f90: New.
        * gfortran.dg/gamma_2.f90: New.
        * gfortran.dg/gamma_3.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/gamma_1.f90
    trunk/gcc/testsuite/gfortran.dg/gamma_2.f90
    trunk/gcc/testsuite/gfortran.dg/gamma_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/mathbuiltins.def
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/32980] Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA)
  2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-08-26 18:12 ` burnus at gcc dot gnu dot org
@ 2007-08-26 18:26 ` burnus at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-26 18:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from burnus at gcc dot gnu dot org  2007-08-26 18:25 -------
FIXED for the trunk/GCC 4.3.0.

The Fortran 2008 bits are tracked in PR 33197.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32980


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-08-26 18:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-03 20:17 [Bug fortran/32980] New: Vendor extension: Intrinsic functions (D)GAMMA, LGAMMA (ALGAMA/DLGAMA) burnus at gcc dot gnu dot org
2007-08-04 17:53 ` [Bug fortran/32980] " fxcoudert at gcc dot gnu dot org
2007-08-04 19:33 ` burnus at gcc dot gnu dot org
2007-08-21 17:06 ` burnus at gcc dot gnu dot org
2007-08-21 17:08 ` burnus at gcc dot gnu dot org
2007-08-21 17:42 ` fxcoudert at gcc dot gnu dot org
2007-08-21 17:52 ` fxcoudert at gcc dot gnu dot org
2007-08-21 19:05 ` burnus at gcc dot gnu dot org
2007-08-21 19:06 ` patchapp at dberlin dot org
2007-08-26 18:12 ` burnus at gcc dot gnu dot org
2007-08-26 18:26 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).