[comp.lang.fortran] intrinsic

quan@sol.surv.utas.oz (Stephen Quan) (12/18/90)

Could anyone give me a list of intrinsic names.
eg.
     COS   SIN   DCOS   DSIN   CHAR ...

My manual lists everything but intrinsics, is it because the Fortran
standard doesn't define them - so it is system dependant?

Stephen Quan,
Surveying Department,
University of Tasmania.

v087mxgb@ubvmsa.cc.buffalo.edu (Shawn E Thompson) (12/18/90)

In article <quan.661481951@sol>, quan@sol.surv.utas.oz (Stephen Quan) writes...
>Could anyone give me a list of intrinsic names.
>eg.
>     COS   SIN   DCOS   DSIN   CHAR ...
> 

My Lahey has them listed as follows (I have omitted the
Lahey extensions, and included only those which they
depict as standards);



( I shan't do more than list them....they are VERY long)


Conversion:

INT
IFIX
IDINT
FLOAT
SINGL
REAL
AINT
DINT
ANINT
DNINT
NINT
ININT
IABS
ABS
DABS
CABS
MOD
AMOD
DMOD
ISIGN
SIGN
DSIGN
IDIM
DIM
DDIM
DPROD
MAX0
AMAX1
DMAX1
AMAX0
MAX1
MIN0
AMIN1
DMIN1
AMIN0
MIN1
AIMAG
CONJG

TRANSCENDENTALS:

SQRT
DSQRT
CSQRT
EXP
DEXP
CEXP
ALOG
DLOG
CLOG
ALOG10
DLOG10

TRIG:

SIN
DSIN
CSIN
COS
DCOS
CCOS
TAN
DTAN
ACOS
DACOS
ASIN
DASIN
ATAN
DATAN
ATAN2
DATAN2

HYPERBOLIC:

SINH
COSH
TANH
DSINH
DCOSH
DTANH

CHARACTER:

LGE
LGT
LLE
LLT

LEN
INDEX
CHAR
ICHAR






in general D prefix indicates double precision, C=complex,
etcetera.......

most are pretty excplanatory



Shawn E. Thompson "..my sig file was so long, I'm not even allowed a quote..."
v087mxgb@ubvms.cc.buffalo.edu | set@autarch.acsu.buffalo.edu
University @ Buffalo|Graduate School of Mechanical Engineering
CAD Engineering|Leica, Inc.|PO Box 123|Buffalo, NY 14240-0123|(716)891-3375

mroussel@alchemy.chem.utoronto.ca (Marc Roussel) (12/18/90)

In article <52072@eerie.acsu.Buffalo.EDU> v087mxgb@ubvmsa.cc.buffalo.edu writes:
>In article <quan.661481951@sol>, quan@sol.surv.utas.oz (Stephen Quan) writes...
>>Could anyone give me a list of intrinsic names.
>>eg.
>>     COS   SIN   DCOS   DSIN   CHAR ...
>
>My Lahey has them listed as follows (I have omitted the
>Lahey extensions, and included only those which they
>depict as standards);
>
>Conversion:
[...]
>IFIX

Is this standard?  My Fortran guide doesn't mention it.  What does it do?

>IDINT
>FLOAT
>SINGL

Are any of these standard?

[...]
>MAX0
>AMAX1
>DMAX1
>AMAX0
>MAX1
>MIN0
>AMIN1
>DMIN1
>AMIN0
>MIN1

My Fortran book only mentions MAX and MIN as standard.  (We are talking
Fortran 77, aren't we?)  What do the 0's and 1's mean?  Whose compiler
understands these?

				Marc R. Roussel
                                mroussel@alchemy.chem.utoronto.ca

quan@sol.surv.utas.edu.au (Stephen Quan) (12/18/90)

v087mxgb@ubvmsa.cc.buffalo.edu (Shawn E Thompson) writes:
>In article <quan.661481951@sol>, quan@sol.surv.utas.oz (Stephen Quan) writes...
>>Could anyone give me a list of intrinsic names.
>>eg.
>>     COS   SIN   DCOS   DSIN   CHAR ...

[..]

>CHARACTER:

>LGE
>LGT
>LLE
>LLT

>LEN
>INDEX
>CHAR
>ICHAR

You beauty!  This helps a great deal!  For instance, I've replaced 26
IF statements in my uppercase to lowercase conversion routine by one!
- Don't tell me there is an instrinic to do *that* already!

Stephen Quan,
University of Tasmania.

monk@cassandra.math.udel.edu (Peter Monk) (12/18/90)

In your posting you ask:

Are any of these standard?

[...]
>MAX0
>AMAX1
>DMAX1
>AMAX0
>MAX1
>MIN0
>AMIN1
>DMIN1
>AMIN0
>MIN1


All these appear in a FORTRAN IV manual (IBM System/360 and System/370 
GC28-6515-10 June 1981) I've had for some time.  All are listed as `
"ANS FORTRAN Intrinsic functions" whereas simple "MAX" is flagged as 
an extension.  To list the differences would take too
much typing but for example

MAX and MAX0 perform the same function (extract the maximum form a list of
integers) whereas MAX1 extracts the maximum of a list of reals but returns
an integer (it's not clear from the manual if the integer is obtained by
rounding/chopping/guessing...) and AMAX1 extracts the maximum from a list
of reals.

Hope this is some help.

--------> Peter Monk 
                                         ***************************
                                         *  Dept of Math Sci       *
                                         *  University of Delaware *
                                         *  monk@math.udel.edu     *
                                         ***************************
------------------------------------------------------------

ags@seaman.cc.purdue.edu (Dave Seaman) (12/18/90)

In article <52072@eerie.acsu.Buffalo.EDU> v087mxgb@ubvmsa.cc.buffalo.edu writes:

=>( I shan't do more than list them....they are VERY long)

The list would be shorter if you limited it to generic function names, which
are the only ones that should be used in new programs.

=>MAX0
=>AMAX1
=>DMAX1
=>AMAX0
=>MAX1
=>MIN0
=>AMIN1
=>DMIN1
=>AMIN0
=>MIN1

All of the above should be replaced by the generic name MAX.

The names you gave are called "specific intrinsic function names" by the
standard.  Although they are still recognized, they should not be used in new
programs.

=>TRANSCENDENTALS:

=>SQRT
=>DSQRT
=>CSQRT
=>EXP
=>DEXP
=>CEXP
=>ALOG
=>DLOG
=>CLOG
=>ALOG10
=>DLOG10

=>TRIG:

=>SIN
=>DSIN
 . . .

Something is bogus about your classification scheme, besides the fact that you
included specific names like DSQRT.

The SQRT (DSQRT, CSQRT) function, which you list under "transcendentals", is 
not transcendental.  The trig functions, and several others in your list that 
you do not classify as "transcendental," are in fact transcendental.

Transcendental, by definition, means "not algebraic."  

--
Dave Seaman	  					
ags@seaman.cc.purdue.edu

dprpjf@inetg1.Arco.Com (Paul Fowler) (12/18/90)

In article <1990Dec18.035700.6440@alchemy.chem.utoronto.ca>, mroussel@alchemy.chem.utoronto.ca (Marc Roussel) writes:
> In article <52072@eerie.acsu.Buffalo.EDU> v087mxgb@ubvmsa.cc.buffalo.edu writes:
> >In article <quan.661481951@sol>, quan@sol.surv.utas.oz (Stephen Quan) writes...
> >>Could anyone give me a list of intrinsic names.
> >>eg.
> >>     COS   SIN   DCOS   DSIN   CHAR ...
> >
> >My Lahey has them listed as follows (I have omitted the
> >Lahey extensions, and included only those which they
> >depict as standards);
> >
> >Conversion:
> [...]
> >IFIX
> 
>
> Is this standard?  My Fortran guide doesn't mention it.  What does it do?

Yes.  To quote ANSI X3.9-1978 [ = ISO 1539-1980(E), according to the cover],
page 15-26: "For a of type real, IFIX(a) is the same as INT(a)"

> 
> >IDINT
> >FLOAT
> >SINGL
> 
> Are any of these standard?

Yes.  IDINT is specific intrinsic for double to integer conversion.
FLOAT is real to integer (synonym for REAL, as far as I know).  SNGL is
specific for double to real conversion.

> 
> [...]
> >MAX0
> >AMAX1
> >DMAX1
> >AMAX0
> >MAX1
> >MIN0
> >AMIN1
> >DMIN1
> >AMIN0
> >MIN1
> 
> My Fortran book only mentions MAX and MIN as standard.  (We are talking
> Fortran 77, aren't we?)  What do the 0's and 1's mean?  Whose compiler
> understands these?
> 

If you want to discuss what is or is not Fortran77, the real reference 
has to be the standard as cited above.  If your compiler supports
Fortran77, as defined by ANSI and ISO, then it should understand all of these.

> 				Marc R. Roussel
>                                 mroussel@alchemy.chem.utoronto.ca

I think the confusion is arising because of the distinction between specific
and generic intrinsic functions.  For example, as above, IDINT is the
specific name for the intrinsic function for converting a double
to an integer by truncation.  INT is both the specific name of the function
for truncating a real to an integer, and also serves as the generic name for
the function that converts reals _or_ doubles to integers.  In other words,
if you use INT(a), the compiler is supposed to figure out whether to
use the specific INT or the specific IDINT depending on the type of the
argument "a", if I understand the standard correctly.  

For the record, I append here a list of the generic and specific intrinsic 
functions as listed in Table 5, page 15-22 of ANSI X3.9-1978. 
For descriptions and argument types, see the standard or (I hope) your
compiler documentation.  And please don't ask me to explain the logic
behind why some are listed only as generics, some as specifics with no 
generics, etc.  There are probably readers of this group who were on that
committee and could explain far better than I could.
   
(Sorry if this list makes for a rather lengthy posting... And I hope I didn't
miss any or introduce too many typos!)


GENERIC         SPECIFIC
==============================
INT		INT
		IFIX
		IDINT
-----------------------------
REAL		REAL
		FLOAT
		SNGL
-----------------------------
DBLE
-----------------------------
CMPLX
-----------------------------
		ICHAR
		CHAR
-----------------------------
AINT		AINT
		DINT
-----------------------------
ANINT		ANINT
		DNINT
-----------------------------
NINT		NINT
		IDNINT
----------------------------
ABS	 	IABS
		ABS
		DABS
		CABS
----------------------------
MOD		MOD
		AMOD
		DMOD
----------------------------
SIGN		ISIGN
		SIGN
		DSIGN
----------------------------
DIM		IDIM
		DIM
		DDIM
----------------------------
		DPROD
----------------------------
MAX		MAX0
		AMAX1
		DMAX1
----------------------------
		AMAX0
		MAX1
----------------------------
MIN		MIN0
		AMIN1
		DMIN1
----------------------------
		AMIN0
		MIN1
----------------------------
		LEN
----------------------------
		INDEX
----------------------------
		AIMAG
----------------------------
		CONJG
----------------------------
SQRT		SQRT
		DSQRT
		CSQRT
----------------------------
EXP		EXP
		DEXP
		CEXP
----------------------------
LOG		ALOG
		DLOG
		CLOG
----------------------------
LOG10		ALOG10
		DLOG10
----------------------------
SIN		SIN
		DSIN
		CSIN
----------------------------
COS		COS
		DCOS
		CCOS
----------------------------
TAN		TAN
		DTAN
----------------------------
ASIN		ASIN
		DASIN
----------------------------
ACOS		ACOS
		DACOS
----------------------------
ATAN		ATAN
		DATAN
----------------------------
ATAN2		ATAN2
		DATAN2
----------------------------
SINH		SINH
		DSINH
----------------------------
COSH		COSH
		DCOSH
----------------------------
TANH		TANH
		DTANH
----------------------------
		LGE
----------------------------
		LGT
----------------------------
		LLE
----------------------------
		LLT
----------------------------

-- 
------------------------------------------------------------------------------
#include <std.disclaimer> /* These silly opinions are mine alone, etc., etc. */
------------------------------------------------------------------------------
|  Paul Fowler                      |    When they kick at your front door   |
|  ARCO Oil and Gas Co.             |    How you gonna come?                 |
|  Plano, TX                        |    With your hands up on your head     |
|  phone: 214-754-6525              |    Or on the trigger of your gun?      |
|  dprpjf@arco.com                  |            ( - The Clash - )           |
------------------------------------------------------------------------------

dprpjf@inetg1.Arco.Com (Paul Fowler) (12/18/90)

In article <quan.661519517@sol>, quan@sol.surv.utas.edu.au (Stephen Quan) writes:
> v087mxgb@ubvmsa.cc.buffalo.edu (Shawn E Thompson) writes:
> >In article <quan.661481951@sol>, quan@sol.surv.utas.oz (Stephen Quan) writes...
> >>Could anyone give me a list of intrinsic names.
> >>eg.
> >>     COS   SIN   DCOS   DSIN   CHAR ...
> 

 [..]

> 
> You beauty!  This helps a great deal!  For instance, I've replaced 26
> IF statements in my uppercase to lowercase conversion routine by one!
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> - Don't tell me there is an instrinic to do *that* already!
> 

If you did have an intrinsic to do case conversion, you could count on it not 
being part of the ANSI/ISO Fortran77 standard - because lowercase letters
are not part of the standard character set!  (Of course, if you were
using C, you could use tolower(), but let's not start up THAT war again...)

> Stephen Quan,
> University of Tasmania.

-- 
------------------------------------------------------------------------------
#include <std.disclaimer> /* These silly opinions are mine alone, etc., etc. */
------------------------------------------------------------------------------
|  Paul Fowler                      |    When they kick at your front door   |
|  ARCO Oil and Gas Co.             |    How you gonna come?                 |
|  Plano, TX                        |    With your hands up on your head     |
|  phone: 214-754-6525              |    Or on the trigger of your gun?      |
|  dprpjf@arco.com                  |            ( - The Clash - )           |
------------------------------------------------------------------------------

v087mxgb@ubvmsb.cc.buffalo.edu (Shawn E Thompson) (12/18/90)

In article <2889@mentor.cc.purdue.edu>, ags@seaman.cc.purdue.edu (Dave Seaman) writes...
>In article <52072@eerie.acsu.Buffalo.EDU> v087mxgb@ubvmsa.cc.buffalo.edu writes:
> 
>The SQRT (DSQRT, CSQRT) function, which you list under "transcendentals", is 
>not transcendental.  The trig functions, and several others in your list that 
>you do not classify as "transcendental," are in fact transcendental.
> 
>Transcendental, by definition, means "not algebraic."  
> 

According to your statement, anything NOT algebraic....well
SQRT is not an algebraic function......TRIG functions are....


besides, *I* didn't classify them!  I merely copied my Lahey
manual....


Shawn E. Thompson "..my sig file was so long, I'm not even allowed a quote..."
v087mxgb@ubvms.cc.buffalo.edu | set@autarch.acsu.buffalo.edu
University @ Buffalo|Graduate School of Mechanical Engineering
CAD Engineering|Leica, Inc.|PO Box 123|Buffalo, NY 14240-0123|(716)891-3375

monk@cassandra.udel.edu (Peter Monk) (12/19/90)

In the discussion on intrinsic functions you say:

>According to your statement, anything NOT algebraic....well
>SQRT is not an algebraic function......TRIG functions are....

this is not correct.  An ALGEBRAIC function of one variable is the solution
of a polynomial equation in two variables.  Thus

x-y**2=0

has the solution y=sqrt(x).  Thus SQRT is an algebraic function.  Anything
that is not algebraic is TRANSCENDENTAL.

I offer these comments in the spirit of mathematical nit-picking



--------> Peter Monk 
                                         ***************************
                                         *  Dept of Math Sci       *
                                         *  University of Delaware *
                                         *  monk@math.udel.edu     *
                                         ***************************
------------------------------------------------------------

fwebb@bbn.com (Fred Webb) (12/19/90)

In article <quan.661481951@sol>, quan@sol.surv.utas.oz (Stephen Quan) writes...
>Could anyone give me a list of intrinsic names.
>eg.
>     COS   SIN   DCOS   DSIN   CHAR ...

In article <52072@eerie.acsu.Buffalo.EDU> v087mxgb@ubvmsa.cc.buffalo.edu writes:
>My Lahey has them listed as follows (I have omitted the
>Lahey extensions, and included only those which they
>depict as standards);
> ...

In article <1990Dec18.035700.6440@alchemy.chem.utoronto.ca> mroussel@alchemy.chem.utoronto.ca (Marc Roussel) writes:
>IFIX IDINT FLOAT SINGL MAX0 AMAX1 DMAX1 AMAX0 MAX1 MIN0 AMIN1 DMIN1 AMIN0 MIN1
>Are any of these standard?

Neither ININT (which appeared in Shawn's article), nor IDINT, cited by Marc,
nor SINGL are standard. I think ININT is a typo for IDNINT, and SINGL is a typo
for SNGL, both of which are standard.

In addition to those cited by Shawn, MAX, MIN, DBLE and CMPLX are also
required by the f77 standard.

The following names are supposed to be "generic" names, and work with various
argument types: INT, REAL, DBLE, CMPLX, AINT, ANINT, NINT, ABS, MOD, SIGN, DIM,
MAX, MIN, SQRT, EXP, LOG, LOG10, SIN, COS, TAN, ASIN, ACOS, ATAN, ATAN2, SINH,
COSH, and TANH. The rest of the names are specific names for various argument
combinations. In the MAX/MIN world, 0 implies a integer arguments, 1 implies
real arguments; A implies a real result, D implies a double result (and double
arguments). The functions AMAX0/AMIN0 (integer argument, real result) and
MAX1/MIN1 (real argument, integer result) aren't accessible through the generic
MAX/MIN names.

Any Fortran which doesn't have all of these isn't a full Fortran 77.

					-- Fred