08-227r2
To: J3
From: Toon Moene
Subject: Public Comment J32013
Date: 2008 August 13
Comment by Robert Corbett.
Subject: additional intrinsic functions
Part 1:
I suggest adding a few more functions to the list
of intrinsic functions.
The standard should include an intrinsic function
named COMPLEX. The function should be of the form
COMPLEX(X, [Y, KIND])
where X, Y, and KIND are defined as for the
intrinsic function CMPLX. Unlike CMPLX, if both
X AND Y are present and are REAL and KIND is not
present, the kind type parameter values of X and
Y shall be the same and the kind type parameter
value of the result shall be the same as the kind
type parameter values of X and Y.
J3's response to part 1:
J3 agrees with the assessment of the limitations
of CMPLX and agrees an intrinsic COMPLEX would be
useful. To prevent overlapping functionality
between the two intrinsics, J3 will propose the
following definition of COMPLEX:
COMPLEX(X, Y)
where X and Y are of type REAL and have the same
kind type parameters, neither of them is optional.
The kind type parameter of the result is
the same as that of X and Y.
Part 2:
The degree trigonometric functions COSD, SIND, and
TAND are supplied in most Fortran implementations
already. I have seen several examples of functions
written by users to implement the degree
trigonometric functions. Those functions often
produce poor results. Producing good results
requires a better understanding of floating-point
arithmetic than many users have. Producing
high-quality results (good to within 0.5+epsilon
ulps) is probably beyond the ability of all but a
few dozen users.
J3's response to part 2:
This was not part of the work item list for Fortran 2008.
J3 considers the implementation of these intrinsics
with the desired floating point semantics too large
a change to add them at this stage.
Part 3:
Fortran should also supply routines the functions
EXPM1 and LOGP1, where EXPM1(X) computes EXP(X-1.0)
and LOGP1(X) computes LOG(X+1.0). The functions
should be computed to greater accuracy than the
straightforward implementation. These are functions
for people who know very well how floating-point
arithmetic works. They offer knowledgeable users
a chance to produce highly accurate results in
some cases where it would be difficult to produce
accurate results without using such functions.
J3's response to part 3:
J3 considered this proposal and declined to include
it in the work list.