Commit 8db2ba40 by Steven G. Kargl Committed by Steven G. Kargl

intrinsic.texi: New file.

gfortran.texi: Include it; white space change; fix typo.

From-SVN: r97000
parent ee4b41af
2005-03-34 Steven G. Kargl <kargls@comcast.net>
* intrinsic.texi: New file.
* gfortran.texi: Include it; white space change; fix typo.
2005-03-23 Joseph S. Myers <joseph@codesourcery.com> 2005-03-23 Joseph S. Myers <joseph@codesourcery.com>
* f95-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Remove. * f95-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Remove.
......
...@@ -109,25 +109,31 @@ the GNU Fortran 95 compiler. You can find in this manual how to invoke ...@@ -109,25 +109,31 @@ the GNU Fortran 95 compiler. You can find in this manual how to invoke
@ifset DEVELOPMENT @ifset DEVELOPMENT
@emph{Warning:} This document, and the compiler it describes, are still @emph{Warning:} This document, and the compiler it describes, are still
under development. While efforts are made too keep it up-to-date it might under development. While efforts are made to keep it up-to-date, it might
not accurately reflect the status of the most recent @command{gfortran}. not accurately reflect the status of the most recent @command{gfortran}.
@end ifset @end ifset
@comment
@comment When you add a new menu item, please keep the right hand
@comment aligned to the same column. Do not use tabs. This provides
@comment better formatting.
@comment
@menu @menu
* Copying:: GNU General Public License says * Copying:: GNU General Public License says
how you can copy and share GNU Fortran. how you can copy and share GNU Fortran.
* GNU Free Documentation License:: * GNU Free Documentation License::
How you can copy and share this manual. How you can copy and share this manual.
* Funding:: How to help assure continued work for free software. * Funding:: How to help assure continued work for free software.
* Getting Started:: What you should know about @command{gfortran}. * Getting Started:: What you should know about @command{gfortran}.
* GFORTRAN and GCC:: You can compile Fortran, C, or other programs. * GFORTRAN and GCC:: You can compile Fortran, C, or other programs.
* GFORTRAN and G77:: Why we choose to start from scratch. * GFORTRAN and G77:: Why we chose to start from scratch.
* Invoking GFORTRAN:: Command options supported by @command{gfortran}. * Invoking GFORTRAN:: Command options supported by @command{gfortran}.
* Project Status:: Status of @command{gfortran}, Roadmap, proposed extensions. * Project Status:: Status of @command{gfortran}, roadmap, proposed extensions.
* Contributing:: Helping you can help. * Contributing:: How you can help.
* Standards:: Standards supported by @command{gfortran} * Standards:: Standards supported by @command{gfortran}
* Extensions:: Language extensions implemented by @command{gfortran} * Extensions:: Language extensions implemented by @command{gfortran}
* Index:: Index of this documentation. * Intrinsic Procedures:: Intrinsic procedures supported by @command{gfortran}
* Index:: Index of this documentation.
@end menu @end menu
...@@ -369,7 +375,6 @@ because it was expected to be easier to maintain code we ...@@ -369,7 +375,6 @@ because it was expected to be easier to maintain code we
develop ourselves than to do a major overhaul of @command{g77} first, develop ourselves than to do a major overhaul of @command{g77} first,
and then build a Fortran 95 compiler out of it. and then build a Fortran 95 compiler out of it.
@include invoke.texi @include invoke.texi
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
...@@ -670,6 +675,7 @@ Examples of standard conforming code equivalent to the above example, are: ...@@ -670,6 +675,7 @@ Examples of standard conforming code equivalent to the above example, are:
DATA i,j,x /1,2,3*0.,1./ DATA i,j,x /1,2,3*0.,1./
@end smallexample @end smallexample
@include intrinsic.texi
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
@c Contributing @c Contributing
@c --------------------------------------------------------------------- @c ---------------------------------------------------------------------
......
@ignore
Copyright (C) 2005
Free Software Foundation, Inc.
This is part of the GFORTRAN manual.
For copying conditions, see the file gfortran.texi.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU General Public License'' and ``Funding
Free Software'', the Front-Cover texts being (a) (see below), and with
the Back-Cover Texts being (b) (see below). A copy of the license is
included in the gfdl(7) man page.
Some basic guidelines for editing this document:
(1) The intrinsic procedures are to be listed in alphabetical order.
(2) The generic name is to be use.
(3) The specific names are included in the function index and in a
table at the end of the node (See ABS entry).
(4) Try to maintain the same style for each entry.
@end ignore
@node Intrinsic Procedures
@chapter Intrinsic Procedures
@cindex Intrinsic Procedures
This portion of the document is incomplete and undergoing massive expansion
and editing. All contributions and corrections are strongly encouraged.
@menu
* Introduction: Introduction
* @code{ABORT}: @code{ABORT}, Abort the program
* @code{ABS}: @code{ABS}, Absolute value
* @code{ACHAR}: @code{ACHAR}, Character in @acronym{ASCII} collating sequence
* @code{ACOS}: @code{ACOS}, Arccosine function
* @code{ADJUSTL}: @code{ADJUSTL}, Left adjust a string
* @code{ADJUSTR}: @code{ADJUSTR}, Right adjust a string
@end menu
@node Introduction
@section Introduction to intrinsic procedures
Gfortran provides a rich set of intrinsic procedures that includes all
the intrinsic procedures required by the Fortran 95 standard, a set of
intrinsic procedures for backwards compatibility with Gnu Fortran 77
(i.e., @command{g77}), and a small selection of intrinsic procedures
from the Fortran 2003 standard. Any description here, which conflicts with a
description in either the Fortran 95 standard or the Fortran 2003 standard,
is unintentional and the standard(s) should be considered authoritative.
The enumeration of the @code{KIND} type parameter is processor defined in
the Fortran 95 standard. Gfortran defines the default integer type and
default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
respectively. The standard mandates that both data types shall have
another kind, which have more precision. On typical target architectures
supports by @command{gfortran}, this kind type parameter is @code{KIND=8}.
Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
In the description of generic intrinsic procedures, the kind type parameter
will be specified by @code{KIND=*}, and in the description of specific
names for an intrinsic procedure the kind type parameter will be explicitly
given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}). Finally, for
brevity the optional @code{KIND=} syntax will be omitted.
Many of the intrinsics procedures take one or more optional arguments.
This document follows the convention used in the Fortran 95 standard,
and denotes such arguments by square brackets.
@command{Gfortran} offers the @option{-std=f95} and @option{-std=gnu} options,
which can be used to restrict the set of intrinsic procedures to a
given standard. By default, @command{gfortran} sets the @option{-std=gnu}
option, and so all intrinsic procedures describe here are accepted. There
is one caveat. For a select group of intrinsic procedures, @command{g77}
implemented both a function and a subroutine. Both classes
have been implemented in @command{gfortran} for backwards compatibility
with @command{g77}. It is noted here that these functions and subroutines
cannot be intermixed in a given subprogram. In the descriptions that follow,
the applicable option(s) is noted.
@node @code{ABORT}
@section @code{ABORT} --- Abort the program
@findex @code{ABORT}
@cindex abort
@table @asis
@item @emph{Description}:
@code{ABORT} causes immediate termination of the program. On operating
systems that support a core dump, @code{ABORT} will produce a core dump,
which is suitable for debugging purposes.
@item @emph{Option}:
gnu
@item @emph{Type}:
non-elemental subroutine
@item @emph{Syntax}:
@code{CALL ABORT}
@item @emph{Return value}:
Does not return.
@item @emph{Example}:
@smallexample
program test_abort
integer :: i = 1, j = 2
if (i /= j) call abort
end program test_abort
@end smallexample
@end table
@node @code{ABS}
@section @code{ABS} --- Absolute value
@findex @code{ABS} intrinsic
@findex @code{CABS} intrinsic
@findex @code{DABS} intrinsic
@findex @code{IABS} intrinsic
@findex @code{ZABS} intrinsic
@findex @code{CDABS} intrinsic
@cindex absolute value
@table @asis
@item @emph{Description}:
@code{ABS(X)} computes the absolute value of @code{X}.
@item @emph{Option}:
f95, gnu
@item @emph{Type}:
elemental function
@item @emph{Syntax}:
@code{X = ABS(X)}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
@item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
@code{REAL(*)}, or @code{COMPLEX(*)}.
@end multitable
@item @emph{Return value}:
The return value is of the same type and
kind as the argument except the return value is @code{REAL(*)} for a
@code{COMPLEX(*)} argument.
@item @emph{Example}:
@smallexample
program test_abort
integer :: i = -1
real :: x = -1.e0
complex :: z = (-1.e0,0.e0)
i = abs(i)
x = abs(x)
x = abs(z)
end program test_abort
@end smallexample
@item @emph{Specific names}:
@multitable @columnfractions .24 .24 .24 .24
@item Name @tab Argument @tab Return type @tab Option
@item @code{CABS(Z)} @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)} @tab f95, gnu
@item @code{DABS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
@item @code{IABS(I)} @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab f95, gnu
@item @code{ZABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
@item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
@end multitable
@end table
@node @code{ACHAR}
@section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence
@findex @code{ACHAR} intrinsic
@cindex @acronym{ASCII} collating sequence
@table @asis
@item @emph{Description}:
@code{ACHAR(I)} returns the character located at position @code{I}
in the @acronym{ASCII} collating sequence.
@item @emph{Option}:
f95, gnu
@item @emph{Type}:
elemental function
@item @emph{Syntax}:
@code{C = ACHAR(I)}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
@item @var{I} @tab The type shall be an @code{INTEGER(*)}.
@end multitable
@item @emph{Return value}:
The return value is of type @code{CHARACTER} with a length of one. The
kind type parameter is the same as @code{KIND('A')}.
@item @emph{Example}:
@smallexample
program test_achar
character c
c = achar(32)
end program test_abort
@end smallexample
@end table
@node @code{ACOS}
@section @code{ACOS} --- Arccosine function
@findex @code{ACOS} intrinsic
@findex @code{DACOS} intrinsic
@cindex arccosine
@table @asis
@item @emph{Description}:
@code{ACOS(X)} computes the arccosine of its @var{X}.
@item @emph{Option}:
f95, gnu
@item @emph{Type}:
elemental function
@item @emph{Syntax}:
@code{X = ACOS(X)}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
@item @var{X} @tab The type shall be an @code{REAL(*)}.
@end multitable
@item @emph{Return value}:
The return value is of type @code{REAL(*)} and it lies in the
range @math{ 0 \leq \arccos (x) \leq \pi}.
@item @emph{Example}:
@smallexample
program test_acos
real(8) :: x = 0.866_8
x = achar(x)
end program test_acos
@end smallexample
@item @emph{Specific names}:
@multitable @columnfractions .24 .24 .24 .24
@item Name @tab Argument @tab Return type @tab Option
@item @code{DACOS(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
@end multitable
@end table
@node @code{ADJUSTL}
@section @code{ADJUSTL} --- Left adjust a string
@findex @code{ADJUSTL} intrinsic
@cindex adjust string
@table @asis
@item @emph{Description}:
@code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
Spaces are inserted at the end of the string as needed.
@item @emph{Option}:
f95, gnu
@item @emph{Type}:
elemental function
@item @emph{Syntax}:
@code{STR = ADJUSTL(STR)}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
@item @var{STR} @tab The type shall be @code{CHARACTER}.
@end multitable
@item @emph{Return value}:
The return value is of type @code{CHARACTER} where leading spaces
are removed and the same number of spaces are inserted on the end
of @var{STR}.
@item @emph{Example}:
@smallexample
program test_adjustl
character(len=20) :: str = ' gfortran'
str = adjustl(str)
print *, str
end program test_adjustl
@end smallexample
@end table
@node @code{ADJUSTR}
@section @code{ADJUSTR} --- Right adjust a string
@findex @code{ADJUSTR} intrinsic
@cindex adjust string
@table @asis
@item @emph{Description}:
@code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
Spaces are inserted at the start of the string as needed.
@item @emph{Option}:
f95, gnu
@item @emph{Type}:
elemental function
@item @emph{Syntax}:
@code{STR = ADJUSTR(STR)}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
@item @var{STR} @tab The type shall be @code{CHARACTER}.
@end multitable
@item @emph{Return value}:
The return value is of type @code{CHARACTER} where trailing spaces
are removed and the same number of spaces are inserted at the start
of @var{STR}.
@item @emph{Example}:
@smallexample
program test_adjustr
character(len=20) :: str = 'gfortran'
str = adjustr(str)
print *, str
end program test_adjustr
@end smallexample
@end table
@comment gen aimag
@comment dimag
@comment
@comment gen aint
@comment dint
@comment
@comment gen all
@comment
@comment gen allocated
@comment
@comment gen anint
@comment dnint
@comment
@comment gen any
@comment
@comment gen asin
@comment dasin
@comment
@comment gen associated
@comment
@comment gen atan
@comment datan
@comment
@comment gen atan2
@comment datan2
@comment
@comment gen besj0
@comment dbesj0
@comment
@comment gen besj1
@comment dbesj1
@comment
@comment gen besjn
@comment dbesjn
@comment
@comment gen besy0
@comment dbesy0
@comment
@comment gen besy1
@comment dbesy1
@comment
@comment gen besyn
@comment dbesyn
@comment
@comment gen bit_size
@comment
@comment gen btest
@comment
@comment gen ceiling
@comment
@comment gen char
@comment
@comment gen cmplx
@comment
@comment gen command_argument_count
@comment
@comment gen conjg
@comment dconjg
@comment
@comment gen cos
@comment dcos
@comment ccos
@comment zcos,cdcos
@comment
@comment gen cosh
@comment dcosh
@comment
@comment gen count
@comment
@comment sub cpu_time
@comment
@comment gen cshift
@comment
@comment sub date_and_time
@comment
@comment gen dble
@comment dfloat
@comment
@comment gen dcmplx
@comment
@comment gen digits
@comment
@comment gen dim
@comment idim
@comment ddim
@comment
@comment gen dot_product
@comment
@comment gen dprod
@comment
@comment gen dreal
@comment
@comment sub dtime
@comment
@comment gen eoshift
@comment
@comment gen epsilon
@comment
@comment gen erf
@comment derf
@comment
@comment gen erfc
@comment derfc
@comment
@comment gen etime
@comment sub etime
@comment
@comment sub exit
@comment
@comment gen exp
@comment dexp
@comment cexp
@comment zexp,cdexp
@comment
@comment gen exponent
@comment
@comment gen floor
@comment
@comment sub flush
@comment
@comment gen fnum
@comment
@comment gen fraction
@comment
@comment gen fstat
@comment sub fstat
@comment
@comment sub getarg
@comment
@comment gen getcwd
@comment sub getcwd
@comment
@comment sub getenv
@comment
@comment gen getgid
@comment
@comment gen getpid
@comment
@comment gen getuid
@comment
@comment sub get_command
@comment
@comment sub get_command_argument
@comment
@comment sub get_environment_variable
@comment
@comment gen huge
@comment
@comment gen iachar
@comment
@comment gen iand
@comment
@comment gen iargc
@comment
@comment gen ibclr
@comment
@comment gen ibits
@comment
@comment gen ibset
@comment
@comment gen ichar
@comment
@comment gen ieor
@comment
@comment gen index
@comment
@comment gen int
@comment ifix
@comment idint
@comment
@comment gen ior
@comment
@comment gen irand
@comment
@comment gen ishft
@comment
@comment gen ishftc
@comment
@comment gen kind
@comment
@comment gen lbound
@comment
@comment gen len
@comment
@comment gen len_trim
@comment
@comment gen lge
@comment
@comment gen lgt
@comment
@comment gen lle
@comment
@comment gen llt
@comment
@comment gen log
@comment alog
@comment dlog
@comment clog
@comment zlog, cdlog
@comment
@comment gen log10
@comment alog10
@comment dlog10
@comment
@comment gen logical
@comment
@comment gen matmul
@comment
@comment gen max
@comment max0
@comment amax0
@comment amax1
@comment max1
@comment dmax1
@comment
@comment gen maxexponent
@comment
@comment gen maxloc
@comment
@comment gen maxval
@comment
@comment gen merge
@comment
@comment gen min
@comment min0
@comment amin0
@comment amin1
@comment min1
@comment dmin1
@comment
@comment gen minexponent
@comment
@comment gen minloc
@comment
@comment gen minval
@comment
@comment gen mod
@comment amod
@comment dmod
@comment
@comment gen modulo
@comment
@comment sub mvbits
@comment
@comment gen nearest
@comment
@comment gen nint
@comment idnint
@comment
@comment gen not
@comment
@comment gen null
@comment
@comment gen pack
@comment
@comment gen precision
@comment
@comment gen present
@comment
@comment gen product
@comment
@comment gen radix
@comment
@comment gen rand
@comment ran
@comment
@comment sub random_number
@comment
@comment sub random_seed
@comment
@comment gen range
@comment
@comment gen real
@comment float
@comment sngl
@comment
@comment gen repeat
@comment
@comment gen reshape
@comment
@comment gen rrspacing
@comment
@comment gen scale
@comment
@comment gen scan
@comment
@comment gen second
@comment sub second
@comment
@comment gen selected_int_kind
@comment
@comment gen selected_real_kind
@comment
@comment gen set_exponent
@comment
@comment gen shape
@comment
@comment gen sign
@comment isign
@comment dsign
@comment
@comment gen sin
@comment dsin
@comment csin
@comment zsin,cdsin
@comment
@comment gen sinh
@comment dsinh
@comment
@comment gen size
@comment
@comment gen spacing
@comment
@comment gen spread
@comment
@comment gen sqrt
@comment dsqrt
@comment csqrt
@comment zsqrt,cdsqrt
@comment
@comment sub srand
@comment
@comment gen stat
@comment sub stat
@comment
@comment gen sum
@comment
@comment gen system
@comment sub system
@comment
@comment sub system_clock
@comment
@comment gen tan
@comment dtan
@comment
@comment gen tanh
@comment dtanh
@comment
@comment gen tiny
@comment
@comment gen transfer
@comment
@comment gen transpose
@comment
@comment gen trim
@comment
@comment gen ubound
@comment
@comment gen umask
@comment sub umask
@comment
@comment gen unlink
@comment sub unlink
@comment
@comment gen unpack
@comment
@comment gen verify
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment