OSDN Git Service

* decl.c, dump-parse-tree.c, gfortran.texi, intrinsic.texi,
[pf3gnuchains/gcc-fork.git] / gcc / fortran / intrinsic.texi
1 @ignore
2 Copyright (C) 2005
3 Free Software Foundation, Inc.
4 This is part of the GFORTRAN manual.   
5 For copying conditions, see the file gfortran.texi.
6
7 Permission is granted to copy, distribute and/or modify this document
8 under the terms of the GNU Free Documentation License, Version 1.2 or
9 any later version published by the Free Software Foundation; with the
10 Invariant Sections being ``GNU General Public License'' and ``Funding
11 Free Software'', the Front-Cover texts being (a) (see below), and with
12 the Back-Cover Texts being (b) (see below).  A copy of the license is
13 included in the gfdl(7) man page.
14
15
16 Some basic guidelines for editing this document:
17
18   (1) The intrinsic procedures are to be listed in alphabetical order.
19   (2) The generic name is to be use.
20   (3) The specific names are included in the function index and in a
21       table at the end of the node (See ABS entry).
22   (4) Try to maintain the same style for each entry.
23
24
25 @end ignore
26
27 @node Intrinsic Procedures
28 @chapter Intrinsic Procedures
29 @cindex Intrinsic Procedures
30
31 This portion of the document is incomplete and undergoing massive expansion 
32 and editing.  All contributions and corrections are strongly encouraged. 
33
34 @menu
35 * Introduction:         Introduction
36 * @code{ABORT}:         ABORT,     Abort the program     
37 * @code{ABS}:           ABS,       Absolute value     
38 * @code{ACHAR}:         ACHAR,     Character in @acronym{ASCII} collating sequence
39 * @code{ACOS}:          ACOS,      Arc cosine function
40 * @code{ADJUSTL}:       ADJUSTL,   Left adjust a string
41 * @code{ADJUSTR}:       ADJUSTR,   Right adjust a string
42 * @code{AIMAG}:         AIMAG,     Imaginary part of complex number
43 * @code{AINT}:          AINT,      Truncate to a whole number
44 * @code{ALL}:           ALL,       Determine if all values are true
45 * @code{ALLOCATED}:     ALLOCATED, Status of allocatable entity
46 * @code{ANINT}:         ANINT,     Nearest whole number
47 * @code{ANY}:           ANY,       Determine if any values are true
48 * @code{ASIN}:          ASIN,      Arcsine function
49 * @code{ASSOCIATED}:    ASSOCIATED, Status of a pointer or pointer/target pair
50 * @code{ATAN}:          ATAN,      Arctangent function
51 * @code{ATAN2}:         ATAN2,     Arctangent function
52 * @code{BESJ0}:         BESJ0,     Bessel function of the first kind of order 0
53 * @code{BESJ1}:         BESJ1,     Bessel function of the first kind of order 1
54 * @code{BESJN}:         BESJN,     Bessel function of the first kind
55 * @code{BESY0}:         BESY0,     Bessel function of the second kind of order 0
56 * @code{BESY1}:         BESY1,     Bessel function of the second kind of order 1
57 * @code{BESYN}:         BESYN,     Bessel function of the second kind
58 * @code{BIT_SIZE}:      BIT_SIZE,  Bit size inquiry function
59 * @code{BTEST}:         BTEST,     Bit test function
60 * @code{CEILING}:       CEILING,   Integer ceiling function
61 * @code{CHAR}:          CHAR,      Character conversion function
62 * @code{CMPLX}:         CMPLX,     Complex conversion function
63 * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT,  Command line argument count
64 * @code{CONJG}:         CONJG,     Complex conjugate function
65 * @code{COS}:           COS,       Cosine function
66 * @code{COSH}:          COSH,      Hyperbolic cosine function
67 * @code{COUNT}:         COUNT,     Count occurrences of .TRUE. in an array
68 * @code{CPU_TIME}:      CPU_TIME,  CPU time subroutine
69 * @code{CSHIFT}:        CSHIFT,    Circular array shift function
70 * @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
71 * @code{DBLE}:          DBLE,      Double precision conversion function
72 * @code{DCMPLX}:        DCMPLX,    Double complex conversion function
73 * @code{DFLOAT}:        DFLOAT,    Double precision conversion function
74 * @code{DIGITS}:        DIGITS,    Significant digits function
75 * @code{DIM}:           DIM,       Dim function
76 * @code{DOT_PRODUCT}:   DOT_PRODUCT, Dot product function
77 * @code{DPROD}:         DPROD,     Double product function
78 * @code{DREAL}:         DREAL,     Double real part function
79 * @code{DTIME}:         DTIME,     Execution time subroutine (or function)
80 * @code{EOSHIFT}:       EOSHIFT,   End-off shift function
81 * @code{EPSILON}:       EPSILON,   Epsilon function
82 * @code{ERF}:           ERF,       Error function
83 * @code{ERFC}:          ERFC,      Complementary error function
84 * @code{ETIME}:         ETIME,     Execution time subroutine (or function)
85 * @code{EXIT}:          EXIT,      Exit the program with status.
86 * @code{EXP}:           EXP,       Exponential function
87 * @code{EXPONENT}:      EXPONENT,  Exponent function
88 * @code{FLOOR}:         FLOOR,     Integer floor function
89 * @code{FNUM}:          FNUM,      File number function
90 * @code{LOG}:           LOG,       Logarithm function
91 * @code{LOG10}:         LOG10,     Base 10 logarithm function 
92 * @code{SQRT}:          SQRT,      Square-root function
93 * @code{SIN}:           SIN,       Sine function
94 * @code{SINH}:          SINH,      Hyperbolic sine function
95 * @code{TAN}:           TAN,       Tangent function
96 * @code{TANH}:          TANH,      Hyperbolic tangent function
97 @end menu
98
99 @node Introduction
100 @section Introduction to intrinsic procedures
101
102 Gfortran provides a rich set of intrinsic procedures that includes all
103 the intrinsic procedures required by the Fortran 95 standard, a set of
104 intrinsic procedures for backwards compatibility with Gnu Fortran 77
105 (i.e., @command{g77}), and a small selection of intrinsic procedures
106 from the Fortran 2003 standard.  Any description here, which conflicts with a 
107 description in either the Fortran 95 standard or the Fortran 2003 standard,
108 is unintentional and the standard(s) should be considered authoritative.
109
110 The enumeration of the @code{KIND} type parameter is processor defined in
111 the Fortran 95 standard.  Gfortran defines the default integer type and
112 default real type by @code{INTEGER(KIND=4)} and @code{REAL(KIND=4)},
113 respectively.  The standard mandates that both data types shall have
114 another kind, which have more precision.  On typical target architectures
115 supported by @command{gfortran}, this kind type parameter is @code{KIND=8}.
116 Hence, @code{REAL(KIND=8)} and @code{DOUBLE PRECISION} are equivalent.
117 In the description of generic intrinsic procedures, the kind type parameter
118 will be specified by @code{KIND=*}, and in the description of specific
119 names for an intrinsic procedure the kind type parameter will be explicitly
120 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}).  Finally, for
121 brevity the optional @code{KIND=} syntax will be omitted.
122
123 Many of the intrinsics procedures take one or more optional arguments.
124 This document follows the convention used in the Fortran 95 standard,
125 and denotes such arguments by square brackets.
126
127 @command{Gfortran} offers the @option{-std=f95} and @option{-std=gnu} options,
128 which can be used to restrict the set of intrinsic procedures to a 
129 given standard.  By default, @command{gfortran} sets the @option{-std=gnu}
130 option, and so all intrinsic procedures described here are accepted.  There
131 is one caveat.  For a select group of intrinsic procedures, @command{g77}
132 implemented both a function and a subroutine.  Both classes 
133 have been implemented in @command{gfortran} for backwards compatibility
134 with @command{g77}.  It is noted here that these functions and subroutines
135 cannot be intermixed in a given subprogram.  In the descriptions that follow,
136 the applicable option(s) is noted.
137
138
139
140 @node ABORT
141 @section @code{ABORT} --- Abort the program  
142 @findex @code{ABORT}
143 @cindex abort
144
145 @table @asis
146 @item @emph{Description}:
147 @code{ABORT} causes immediate termination of the program.  On operating
148 systems that support a core dump, @code{ABORT} will produce a core dump,
149 which is suitable for debugging purposes.
150
151 @item @emph{Option}:
152 gnu
153
154 @item @emph{Class}:
155 non-elemental subroutine
156
157 @item @emph{Syntax}:
158 @code{CALL ABORT}
159
160 @item @emph{Return value}:
161 Does not return.
162
163 @item @emph{Example}:
164 @smallexample
165 program test_abort
166   integer :: i = 1, j = 2
167   if (i /= j) call abort
168 end program test_abort
169 @end smallexample
170 @end table
171
172
173
174 @node ABS
175 @section @code{ABS} --- Absolute value  
176 @findex @code{ABS} intrinsic
177 @findex @code{CABS} intrinsic
178 @findex @code{DABS} intrinsic
179 @findex @code{IABS} intrinsic
180 @findex @code{ZABS} intrinsic
181 @findex @code{CDABS} intrinsic
182 @cindex absolute value
183
184 @table @asis
185 @item @emph{Description}:
186 @code{ABS(X)} computes the absolute value of @code{X}.
187
188 @item @emph{Option}:
189 f95, gnu
190
191 @item @emph{Class}:
192 elemental function
193
194 @item @emph{Syntax}:
195 @code{X = ABS(X)}
196
197 @item @emph{Arguments}:
198 @multitable @columnfractions .15 .80
199 @item @var{X} @tab The type of the argument shall be an @code{INTEGER(*)},
200 @code{REAL(*)}, or @code{COMPLEX(*)}.
201 @end multitable
202
203 @item @emph{Return value}:
204 The return value is of the same type and
205 kind as the argument except the return value is @code{REAL(*)} for a
206 @code{COMPLEX(*)} argument.
207
208 @item @emph{Example}:
209 @smallexample
210 program test_abs
211   integer :: i = -1
212   real :: x = -1.e0
213   complex :: z = (-1.e0,0.e0)
214   i = abs(i)
215   x = abs(x)
216   x = abs(z)
217 end program test_abs
218 @end smallexample
219
220 @item @emph{Specific names}:
221 @multitable @columnfractions .24 .24 .24 .24
222 @item Name            @tab Argument            @tab Return type       @tab Option
223 @item @code{CABS(Z)}  @tab @code{COMPLEX(4) Z} @tab @code{REAL(4)}    @tab f95, gnu
224 @item @code{DABS(X)}  @tab @code{REAL(8)    X} @tab @code{REAL(8)}    @tab f95, gnu
225 @item @code{IABS(I)}  @tab @code{INTEGER(4) I} @tab @code{INTEGER(4)} @tab f95, gnu
226 @item @code{ZABS(Z)}  @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
227 @item @code{CDABS(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
228 @end multitable
229 @end table
230
231
232
233 @node ACHAR
234 @section @code{ACHAR} --- Character in @acronym{ASCII} collating sequence 
235 @findex @code{ACHAR} intrinsic
236 @cindex @acronym{ASCII} collating sequence
237
238 @table @asis
239 @item @emph{Description}:
240 @code{ACHAR(I)} returns the character located at position @code{I}
241 in the @acronym{ASCII} collating sequence.
242
243 @item @emph{Option}:
244 f95, gnu
245
246 @item @emph{Class}:
247 elemental function
248
249 @item @emph{Syntax}:
250 @code{C = ACHAR(I)}
251
252 @item @emph{Arguments}:
253 @multitable @columnfractions .15 .80
254 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
255 @end multitable
256
257 @item @emph{Return value}:
258 The return value is of type @code{CHARACTER} with a length of one.  The
259 kind type parameter is the same as  @code{KIND('A')}.
260
261 @item @emph{Example}:
262 @smallexample
263 program test_achar
264   character c
265   c = achar(32)
266 end program test_achar
267 @end smallexample
268 @end table
269
270
271
272 @node ACOS
273 @section @code{ACOS} --- Arc cosine function 
274 @findex @code{ACOS} intrinsic
275 @findex @code{DACOS} intrinsic
276 @cindex arc cosine
277
278 @table @asis
279 @item @emph{Description}:
280 @code{ACOS(X)} computes the arc cosine of @var{X}.
281
282 @item @emph{Option}:
283 f95, gnu
284
285 @item @emph{Class}:
286 elemental function
287
288 @item @emph{Syntax}:
289 @code{X = ACOS(X)}
290
291 @item @emph{Arguments}:
292 @multitable @columnfractions .15 .80
293 @item @var{X} @tab The type shall be @code{REAL(*)} with a magnitude that is
294 less than one.
295 @end multitable
296
297 @item @emph{Return value}:
298 The return value is of type @code{REAL(*)} and it lies in the
299 range @math{ 0 \leq \arccos (x) \leq \pi}.  The kind type
300 parameter is the same as @var{X}.
301
302 @item @emph{Example}:
303 @smallexample
304 program test_acos
305   real(8) :: x = 0.866_8
306   x = achar(x)
307 end program test_acos
308 @end smallexample
309
310 @item @emph{Specific names}:
311 @multitable @columnfractions .24 .24 .24 .24
312 @item Name            @tab Argument          @tab Return type       @tab Option
313 @item @code{DACOS(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
314 @end multitable
315 @end table
316
317
318
319 @node ADJUSTL
320 @section @code{ADJUSTL} --- Left adjust a string 
321 @findex @code{ADJUSTL} intrinsic
322 @cindex adjust string
323
324 @table @asis
325 @item @emph{Description}:
326 @code{ADJUSTL(STR)} will left adjust a string by removing leading spaces.
327 Spaces are inserted at the end of the string as needed.
328
329 @item @emph{Option}:
330 f95, gnu
331
332 @item @emph{Class}:
333 elemental function
334
335 @item @emph{Syntax}:
336 @code{STR = ADJUSTL(STR)}
337
338 @item @emph{Arguments}:
339 @multitable @columnfractions .15 .80
340 @item @var{STR} @tab The type shall be @code{CHARACTER}.
341 @end multitable
342
343 @item @emph{Return value}:
344 The return value is of type @code{CHARACTER} where leading spaces 
345 are removed and the same number of spaces are inserted on the end
346 of @var{STR}.
347
348 @item @emph{Example}:
349 @smallexample
350 program test_adjustl
351   character(len=20) :: str = '   gfortran'
352   str = adjustl(str)
353   print *, str
354 end program test_adjustl
355 @end smallexample
356 @end table
357
358
359
360 @node ADJUSTR
361 @section @code{ADJUSTR} --- Right adjust a string 
362 @findex @code{ADJUSTR} intrinsic
363 @cindex adjust string
364
365 @table @asis
366 @item @emph{Description}:
367 @code{ADJUSTR(STR)} will right adjust a string by removing trailing spaces.
368 Spaces are inserted at the start of the string as needed.
369
370 @item @emph{Option}:
371 f95, gnu
372
373 @item @emph{Class}:
374 elemental function
375
376 @item @emph{Syntax}:
377 @code{STR = ADJUSTR(STR)}
378
379 @item @emph{Arguments}:
380 @multitable @columnfractions .15 .80
381 @item @var{STR} @tab The type shall be @code{CHARACTER}.
382 @end multitable
383
384 @item @emph{Return value}:
385 The return value is of type @code{CHARACTER} where trailing spaces 
386 are removed and the same number of spaces are inserted at the start
387 of @var{STR}.
388
389 @item @emph{Example}:
390 @smallexample
391 program test_adjustr
392   character(len=20) :: str = 'gfortran'
393   str = adjustr(str)
394   print *, str
395 end program test_adjustr
396 @end smallexample
397 @end table
398
399
400
401 @node AIMAG
402 @section @code{AIMAG} --- Imaginary part of complex number  
403 @findex @code{AIMAG} intrinsic
404 @findex @code{DIMAG} intrinsic
405 @cindex Imaginary part
406
407 @table @asis
408 @item @emph{Description}:
409 @code{AIMAG(Z)} yields the imaginary part of complex argument @code{Z}.
410
411 @item @emph{Option}:
412 f95, gnu
413
414 @item @emph{Class}:
415 elemental function
416
417 @item @emph{Syntax}:
418 @code{X = AIMAG(Z)}
419
420 @item @emph{Arguments}:
421 @multitable @columnfractions .15 .80
422 @item @var{Z} @tab The type of the argument shall be @code{COMPLEX(*)}.
423 @end multitable
424
425 @item @emph{Return value}:
426 The return value is of type real with the
427 kind type parameter of the argument.
428
429 @item @emph{Example}:
430 @smallexample
431 program test_aimag
432   complex(4) z4
433   complex(8) z8
434   z4 = cmplx(1.e0_4, 0.e0_4)
435   z8 = cmplx(0.e0_8, 1.e0_8)
436   print *, aimag(z4), dimag(z8)
437 end program test_aimag
438 @end smallexample
439
440 @item @emph{Specific names}:
441 @multitable @columnfractions .24 .24 .24 .24
442 @item Name            @tab Argument            @tab Return type       @tab Option
443 @item @code{DIMAG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{REAL(8)}    @tab f95, gnu
444 @end multitable
445 @end table
446
447
448
449 @node AINT
450 @section @code{AINT} --- Imaginary part of complex number  
451 @findex @code{AINT} intrinsic
452 @findex @code{DINT} intrinsic
453 @cindex whole number
454
455 @table @asis
456 @item @emph{Description}:
457 @code{AINT(X [, KIND])} truncates its argument to a whole number.
458
459 @item @emph{Option}:
460 f95, gnu
461
462 @item @emph{Class}:
463 elemental function
464
465 @item @emph{Syntax}:
466 @code{X = AINT(X)} 
467 @code{X = AINT(X, KIND)}
468
469 @item @emph{Arguments}:
470 @multitable @columnfractions .15 .80
471 @item @var{X}    @tab The type of the argument shall be @code{REAL(*)}.
472 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
473 initialization expression.
474 @end multitable
475
476 @item @emph{Return value}:
477 The return value is of type real with the kind type parameter of the
478 argument if the optional @var{KIND} is absent; otherwise, the kind
479 type parameter will be given by @var{KIND}.  If the magnitude of 
480 @var{X} is less than one, then @code{AINT(X)} returns zero.  If the
481 magnitude is equal to or greater than one, then it returns the largest
482 whole number that does not exceed its magnitude.  The sign is the same
483 as the sign of @var{X}. 
484
485 @item @emph{Example}:
486 @smallexample
487 program test_aint
488   real(4) x4
489   real(8) x8
490   x4 = 1.234E0_4
491   x8 = 4.321_8
492   print *, aint(x4), dint(x8)
493   x8 = aint(x4,8)
494 end program test_aint
495 @end smallexample
496
497 @item @emph{Specific names}:
498 @multitable @columnfractions .24 .24 .24 .24
499 @item Name           @tab Argument         @tab Return type      @tab Option
500 @item @code{DINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)}   @tab f95, gnu
501 @end multitable
502 @end table
503
504
505
506 @node ALL
507 @section @code{ALL} --- All values in @var{MASK} along @var{DIM} are true 
508 @findex @code{ALL} intrinsic
509 @cindex true values
510
511 @table @asis
512 @item @emph{Description}:
513 @code{ALL(MASK [, DIM])} determines if all the values are true in @var{MASK}
514 in the array along dimension @var{DIM}.
515
516 @item @emph{Option}:
517 f95, gnu
518
519 @item @emph{Class}:
520 transformational function
521
522 @item @emph{Syntax}:
523 @code{L = ALL(MASK)} 
524 @code{L = ALL(MASK, DIM)}
525
526 @item @emph{Arguments}:
527 @multitable @columnfractions .15 .80
528 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
529 it shall not be scalar.
530 @item @var{DIM}  @tab (Optional) @var{DIM} shall be a scalar integer
531 with a value that lies between one and the rank of @var{MASK}.
532 @end multitable
533
534 @item @emph{Return value}:
535 @code{ALL(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
536 the kind type parameter is the same as the kind type parameter of
537 @var{MASK}.  If @var{DIM} is present, then @code{ALL(MASK, DIM)} returns
538 an array with the rank of @var{MASK} minus 1.  The shape is determined from
539 the shape of @var{MASK} where the @var{DIM} dimension is elided. 
540
541 @table @asis
542 @item (A)
543 @code{ALL(MASK)} is true if all elements of @var{MASK} are true.
544 It also is true if @var{MASK} has zero size; otherwise, it is false.
545 @item (B)
546 If the rank of @var{MASK} is one, then @code{ALL(MASK,DIM)} is equivalent
547 to @code{ALL(MASK)}.  If the rank is greater than one, then @code{ALL(MASK,DIM)}
548 is determined by applying @code{ALL} to the array sections.
549 @end table
550
551 @item @emph{Example}:
552 @smallexample
553 program test_all
554   logical l
555   l = all((/.true., .true., .true./))
556   print *, l
557   call section
558   contains
559     subroutine section
560       integer a(2,3), b(2,3)
561       a = 1
562       b = 1
563       b(2,2) = 2
564       print *, all(a .eq. b, 1)
565       print *, all(a .eq. b, 2)
566     end subroutine section
567 end program test_all
568 @end smallexample
569 @end table
570
571
572
573 @node ALLOCATED
574 @section @code{ALLOCATED} --- Status of an allocatable entity
575 @findex @code{ALLOCATED} intrinsic
576 @cindex allocation status
577
578 @table @asis
579 @item @emph{Description}:
580 @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
581
582 @item @emph{Option}:
583 f95, gnu
584
585 @item @emph{Class}:
586 inquiry function
587
588 @item @emph{Syntax}:
589 @code{L = ALLOCATED(X)}
590
591 @item @emph{Arguments}:
592 @multitable @columnfractions .15 .80
593 @item @var{X}    @tab The argument shall be an @code{ALLOCATABLE} array.
594 @end multitable
595
596 @item @emph{Return value}:
597 The return value is a scalar @code{LOGICAL} with the default logical
598 kind type parameter.  If @var{X} is allocated, @code{ALLOCATED(X)}
599 is @code{.TRUE.}; otherwise, it returns the @code{.TRUE.} 
600
601 @item @emph{Example}:
602 @smallexample
603 program test_allocated
604   integer :: i = 4
605   real(4), allocatable :: x(:)
606   if (allocated(x) .eqv. .false.) allocate(x(i)
607 end program test_allocated
608 @end smallexample
609 @end table
610
611
612
613 @node ANINT
614 @section @code{ANINT} --- Imaginary part of complex number  
615 @findex @code{ANINT} intrinsic
616 @findex @code{DNINT} intrinsic
617 @cindex whole number
618
619 @table @asis
620 @item @emph{Description}:
621 @code{ANINT(X [, KIND])} rounds its argument to the nearest whole number.
622
623 @item @emph{Option}:
624 f95, gnu
625
626 @item @emph{Class}:
627 elemental function
628
629 @item @emph{Syntax}:
630 @code{X = ANINT(X)}
631 @code{X = ANINT(X, KIND)}
632
633 @item @emph{Arguments}:
634 @multitable @columnfractions .15 .80
635 @item @var{X}    @tab The type of the argument shall be @code{REAL(*)}.
636 @item @var{KIND} @tab (Optional) @var{KIND} shall be a scalar integer
637 initialization expression.
638 @end multitable
639
640 @item @emph{Return value}:
641 The return value is of type real with the kind type parameter of the
642 argument if the optional @var{KIND} is absent; otherwise, the kind
643 type parameter will be given by @var{KIND}.  If @var{X} is greater than
644 zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}.  If @var{X} is
645 less than or equal to zero, then return @code{AINT(X-0.5)}.
646
647 @item @emph{Example}:
648 @smallexample
649 program test_anint
650   real(4) x4
651   real(8) x8
652   x4 = 1.234E0_4
653   x8 = 4.321_8
654   print *, anint(x4), dnint(x8)
655   x8 = anint(x4,8)
656 end program test_anint
657 @end smallexample
658
659 @item @emph{Specific names}:
660 @multitable @columnfractions .24 .24 .24 .24
661 @item Name            @tab Argument         @tab Return type      @tab Option
662 @item @code{DNINT(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)}   @tab f95, gnu
663 @end multitable
664 @end table
665
666
667
668 @node ANY
669 @section @code{ANY} --- Any value in @var{MASK} along @var{DIM} is true 
670 @findex @code{ANY} intrinsic
671 @cindex true values
672
673 @table @asis
674 @item @emph{Description}:
675 @code{ANY(MASK [, DIM])} determines if any of the values in the logical array
676 @var{MASK} along dimension @var{DIM} are @code{.TRUE.}.
677
678 @item @emph{Option}:
679 f95, gnu
680
681 @item @emph{Class}:
682 transformational function
683
684 @item @emph{Syntax}:
685 @code{L = ANY(MASK)} 
686 @code{L = ANY(MASK, DIM)}
687
688 @item @emph{Arguments}:
689 @multitable @columnfractions .15 .80
690 @item @var{MASK} @tab The type of the argument shall be @code{LOGICAL(*)} and
691 it shall not be scalar.
692 @item @var{DIM}  @tab (Optional) @var{DIM} shall be a scalar integer
693 with a value that lies between one and the rank of @var{MASK}.
694 @end multitable
695
696 @item @emph{Return value}:
697 @code{ANY(MASK)} returns a scalar value of type @code{LOGICAL(*)} where
698 the kind type parameter is the same as the kind type parameter of
699 @var{MASK}.  If @var{DIM} is present, then @code{ANY(MASK, DIM)} returns
700 an array with the rank of @var{MASK} minus 1.  The shape is determined from
701 the shape of @var{MASK} where the @var{DIM} dimension is elided. 
702
703 @table @asis
704 @item (A)
705 @code{ANY(MASK)} is true if any element of @var{MASK} is true;
706 otherwise, it is false.  It also is false if @var{MASK} has zero size.
707 @item (B)
708 If the rank of @var{MASK} is one, then @code{ANY(MASK,DIM)} is equivalent
709 to @code{ANY(MASK)}.  If the rank is greater than one, then @code{ANY(MASK,DIM)}
710 is determined by applying @code{ANY} to the array sections.
711 @end table
712
713 @item @emph{Example}:
714 @smallexample
715 program test_any
716   logical l
717   l = any((/.true., .true., .true./))
718   print *, l
719   call section
720   contains
721     subroutine section
722       integer a(2,3), b(2,3)
723       a = 1
724       b = 1
725       b(2,2) = 2
726       print *, any(a .eq. b, 1)
727       print *, any(a .eq. b, 2)
728     end subroutine section
729 end program test_any
730 @end smallexample
731 @end table
732
733
734
735 @node ASIN
736 @section @code{ASIN} --- Arcsine function 
737 @findex @code{ASIN} intrinsic
738 @findex @code{DASIN} intrinsic
739 @cindex arcsine
740
741 @table @asis
742 @item @emph{Description}:
743 @code{ASIN(X)} computes the arcsine of its @var{X}.
744
745 @item @emph{Option}:
746 f95, gnu
747
748 @item @emph{Class}:
749 elemental function
750
751 @item @emph{Syntax}:
752 @code{X = ASIN(X)}
753
754 @item @emph{Arguments}:
755 @multitable @columnfractions .15 .80
756 @item @var{X} @tab The type shall be @code{REAL(*)}, and a magnitude that is
757 less than one.
758 @end multitable
759
760 @item @emph{Return value}:
761 The return value is of type @code{REAL(*)} and it lies in the
762 range @math{-\pi / 2 \leq \arccos (x) \leq \pi / 2}.  The kind type
763 parameter is the same as @var{X}.
764
765 @item @emph{Example}:
766 @smallexample
767 program test_asin
768   real(8) :: x = 0.866_8
769   x = asin(x)
770 end program test_asin
771 @end smallexample
772
773 @item @emph{Specific names}:
774 @multitable @columnfractions .24 .24 .24 .24
775 @item Name            @tab Argument          @tab Return type       @tab Option
776 @item @code{DASIN(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
777 @end multitable
778 @end table
779
780
781
782 @node ASSOCIATED
783 @section @code{ASSOCIATED} --- Status of a pointer or pointer/target pair 
784 @findex @code{ASSOCIATED} intrinsic
785 @cindex pointer status
786
787 @table @asis
788 @item @emph{Description}:
789 @code{ASSOCIATED(PTR [, TGT])} determines the status of the pointer @var{PTR}
790 or if @var{PTR} is associated with the target @var{TGT}.
791
792 @item @emph{Option}:
793 f95, gnu
794
795 @item @emph{Class}:
796 inquiry function
797
798 @item @emph{Syntax}:
799 @code{L = ASSOCIATED(PTR)} 
800 @code{L = ASSOCIATED(PTR [, TGT])}
801
802 @item @emph{Arguments}:
803 @multitable @columnfractions .15 .80
804 @item @var{PTR} @tab @var{PTR} shall have the @code{POINTER} attribute and
805 it can be of any type.
806 @item @var{TGT} @tab (Optional) @var{TGT} shall be a @code{POINTER} or
807 a @code{TARGET}.  It must have the same type, kind type parameter, and
808 array rank as @var{PTR}.
809 @end multitable
810 The status of neither @var{PTR} nor @var{TGT} can be undefined.
811
812 @item @emph{Return value}:
813 @code{ASSOCIATED(PTR)} returns a scalar value of type @code{LOGICAL(4)}.
814 There are several cases:
815 @table @asis
816 @item (A) If the optional @var{TGT} is not present, then @code{ASSOCIATED(PTR)}
817 is true if @var{PTR} is associated with a target; otherwise, it returns false.
818 @item (B) If @var{TGT} is present and a scalar target, the result is true if
819 @var{TGT}
820 is not a 0 sized storage sequence and the target associated with @var{PTR}
821 occupies the same storage units.  If @var{PTR} is disassociated, then the 
822 result is false.
823 @item (C) If @var{TGT} is present and an array target, the result is true if
824 @var{TGT} and @var{PTR} have the same shape, are not 0 sized arrays, are
825 arrays whose elements are not 0 sized storage sequences, and @var{TGT} and
826 @var{PTR} occupy the same storage units in array element order.
827 As in case(B), the result is false, if @var{PTR} is disassociated.
828 @item (D) If @var{TGT} is present and an scalar pointer, the result is true if
829 target associated with @var{PTR} and the target associated with @var{TGT}
830 are not 0 sized storage sequences and occupy the same storage units.
831 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
832 @item (E) If @var{TGT} is present and an array pointer, the result is true if
833 target associated with @var{PTR} and the target associated with @var{TGT}
834 have the same shape, are not 0 sized arrays, are arrays whose elements are
835 not 0 sized storage sequences, and @var{TGT} and @var{PTR} occupy the same
836 storage units in array element order.
837 The result is false, if either @var{TGT} or @var{PTR} is disassociated.
838 @end table
839
840 @item @emph{Example}:
841 @smallexample
842 program test_associated
843    implicit none
844    real, target  :: tgt(2) = (/1., 2./)
845    real, pointer :: ptr(:)
846    ptr => tgt
847    if (associated(ptr)     .eqv. .false.) call abort
848    if (associated(ptr,tgt) .eqv. .false.) call abort
849 end program test_associated
850 @end smallexample
851 @end table
852
853
854
855 @node ATAN
856 @section @code{ATAN} --- Arctangent function 
857 @findex @code{ATAN} intrinsic
858 @findex @code{DATAN} intrinsic
859 @cindex arctangent
860
861 @table @asis
862 @item @emph{Description}:
863 @code{ATAN(X)} computes the arctangent of @var{X}.
864
865 @item @emph{Option}:
866 f95, gnu
867
868 @item @emph{Class}:
869 elemental function
870
871 @item @emph{Syntax}:
872 @code{X = ATAN(X)}
873
874 @item @emph{Arguments}:
875 @multitable @columnfractions .15 .80
876 @item @var{X} @tab The type shall be @code{REAL(*)}.
877 @end multitable
878
879 @item @emph{Return value}:
880 The return value is of type @code{REAL(*)} and it lies in the
881 range @math{ - \pi / 2 \leq \arcsin (x) \leq \pi / 2}.
882
883 @item @emph{Example}:
884 @smallexample
885 program test_atan
886   real(8) :: x = 2.866_8
887   x = atan(x)
888 end program test_atan
889 @end smallexample
890
891 @item @emph{Specific names}:
892 @multitable @columnfractions .24 .24 .24 .24
893 @item Name            @tab Argument          @tab Return type       @tab Option
894 @item @code{DATAN(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
895 @end multitable
896 @end table
897
898
899
900 @node ATAN2
901 @section @code{ATAN2} --- Arctangent function 
902 @findex @code{ATAN2} intrinsic
903 @findex @code{DATAN2} intrinsic
904 @cindex arctangent
905
906 @table @asis
907 @item @emph{Description}:
908 @code{ATAN2(Y,X)} computes the arctangent of the complex number @math{X + i Y}.
909
910 @item @emph{Option}:
911 f95, gnu
912
913 @item @emph{Class}:
914 elemental function
915
916 @item @emph{Syntax}:
917 @code{X = ATAN2(Y,X)}
918
919 @item @emph{Arguments}:
920 @multitable @columnfractions .15 .80
921 @item @var{Y} @tab The type shall be @code{REAL(*)}.
922 @item @var{X} @tab The type and kind type parameter shall be the same as @var{Y}.
923 If @var{Y} is zero, then @var{X} must be nonzero.
924 @end multitable
925
926 @item @emph{Return value}:
927 The return value has the same type and kind type parameter as @var{Y}.
928 It is the principle value of the complex number @math{X + i Y}.  If
929 @var{X} is nonzero, then it lies in the range @math{-\pi \le \arccos (x) \leq \pi}.
930 The sign is positive if @var{Y} is positive.  If @var{Y} is zero, then
931 the return value is zero if @var{X} is positive and @math{\pi} if @var{X}
932 is negative.  Finally, if @var{X} is zero, then the magnitude of the result
933 is @math{\pi/2}.
934
935 @item @emph{Example}:
936 @smallexample
937 program test_atan2
938   real(4) :: x = 1.e0_4, y = 0.5e0_4
939   x = atan2(y,x)
940 end program test_atan2
941 @end smallexample
942
943 @item @emph{Specific names}:
944 @multitable @columnfractions .24 .24 .24 .24
945 @item Name            @tab Argument          @tab Return type    @tab Option
946 @item @code{DATAN2(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab f95, gnu
947 @end multitable
948 @end table
949
950
951
952 @node BESJ0
953 @section @code{BESJ0} --- Bessel function of the first kind of order 0
954 @findex @code{BESJ0} intrinsic
955 @findex @code{DBESJ0} intrinsic
956 @cindex Bessel
957
958 @table @asis
959 @item @emph{Description}:
960 @code{BESJ0(X)} computes the Bessel function of the first kind of order 0
961 of @var{X}.
962
963 @item @emph{Option}:
964 gnu
965
966 @item @emph{Class}:
967 elemental function
968
969 @item @emph{Syntax}:
970 @code{X = BESJ0(X)}
971
972 @item @emph{Arguments}:
973 @multitable @columnfractions .15 .80
974 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
975 @end multitable
976
977 @item @emph{Return value}:
978 The return value is of type @code{REAL(*)} and it lies in the
979 range @math{ - 0.4027... \leq Bessel (0,x) \leq 1}.
980
981 @item @emph{Example}:
982 @smallexample
983 program test_besj0
984   real(8) :: x = 0.0_8
985   x = besj0(x)
986 end program test_besj0
987 @end smallexample
988
989 @item @emph{Specific names}:
990 @multitable @columnfractions .24 .24 .24 .24
991 @item Name            @tab Argument          @tab Return type       @tab Option
992 @item @code{DBESJ0(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab gnu
993 @end multitable
994 @end table
995
996
997
998 @node BESJ1
999 @section @code{BESJ1} --- Bessel function of the first kind of order 1
1000 @findex @code{BESJ1} intrinsic
1001 @findex @code{DBESJ1} intrinsic
1002 @cindex Bessel
1003
1004 @table @asis
1005 @item @emph{Description}:
1006 @code{BESJ1(X)} computes the Bessel function of the first kind of order 1
1007 of @var{X}.
1008
1009 @item @emph{Option}:
1010 gnu
1011
1012 @item @emph{Class}:
1013 elemental function
1014
1015 @item @emph{Syntax}:
1016 @code{X = BESJ1(X)}
1017
1018 @item @emph{Arguments}:
1019 @multitable @columnfractions .15 .80
1020 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1021 @end multitable
1022
1023 @item @emph{Return value}:
1024 The return value is of type @code{REAL(*)} and it lies in the
1025 range @math{ - 0.5818... \leq Bessel (0,x) \leq 0.5818 }.
1026
1027 @item @emph{Example}:
1028 @smallexample
1029 program test_besj1
1030   real(8) :: x = 1.0_8
1031   x = besj1(x)
1032 end program test_besj1
1033 @end smallexample
1034
1035 @item @emph{Specific names}:
1036 @multitable @columnfractions .24 .24 .24 .24
1037 @item Name            @tab Argument          @tab Return type       @tab Option
1038 @item @code{DBESJ1(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab gnu
1039 @end multitable
1040 @end table
1041
1042
1043
1044 @node BESJN
1045 @section @code{BESJN} --- Bessel function of the first kind
1046 @findex @code{BESJN} intrinsic
1047 @findex @code{DBESJN} intrinsic
1048 @cindex Bessel
1049
1050 @table @asis
1051 @item @emph{Description}:
1052 @code{BESJN(N, X)} computes the Bessel function of the first kind of order
1053 @var{N} of @var{X}.
1054
1055 @item @emph{Option}:
1056 gnu
1057
1058 @item @emph{Class}:
1059 elemental function
1060
1061 @item @emph{Syntax}:
1062 @code{Y = BESJN(N, X)}
1063
1064 @item @emph{Arguments}:
1065 @multitable @columnfractions .15 .80
1066 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1067 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1068 @end multitable
1069
1070 @item @emph{Return value}:
1071 The return value is a scalar of type @code{REAL(*)}.
1072
1073 @item @emph{Example}:
1074 @smallexample
1075 program test_besjn
1076   real(8) :: x = 1.0_8
1077   x = besjn(5,x)
1078 end program test_besjn
1079 @end smallexample
1080
1081 @item @emph{Specific names}:
1082 @multitable @columnfractions .24 .24 .24 .24
1083 @item Name             @tab Argument            @tab Return type       @tab Option
1084 @item @code{DBESJN(X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)}    @tab gnu
1085 @item                  @tab @code{REAL(8) X}    @tab                   @tab
1086 @end multitable
1087 @end table
1088
1089
1090
1091 @node BESY0
1092 @section @code{BESY0} --- Bessel function of the second kind of order 0
1093 @findex @code{BESY0} intrinsic
1094 @findex @code{DBESY0} intrinsic
1095 @cindex Bessel
1096
1097 @table @asis
1098 @item @emph{Description}:
1099 @code{BESY0(X)} computes the Bessel function of the second kind of order 0
1100 of @var{X}.
1101
1102 @item @emph{Option}:
1103 gnu
1104
1105 @item @emph{Class}:
1106 elemental function
1107
1108 @item @emph{Syntax}:
1109 @code{X = BESY0(X)}
1110
1111 @item @emph{Arguments}:
1112 @multitable @columnfractions .15 .80
1113 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1114 @end multitable
1115
1116 @item @emph{Return value}:
1117 The return value is a scalar of type @code{REAL(*)}.
1118
1119 @item @emph{Example}:
1120 @smallexample
1121 program test_besy0
1122   real(8) :: x = 0.0_8
1123   x = besy0(x)
1124 end program test_besy0
1125 @end smallexample
1126
1127 @item @emph{Specific names}:
1128 @multitable @columnfractions .24 .24 .24 .24
1129 @item Name            @tab Argument          @tab Return type       @tab Option
1130 @item @code{DBESY0(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab gnu
1131 @end multitable
1132 @end table
1133
1134
1135
1136 @node BESY1
1137 @section @code{BESY1} --- Bessel function of the second kind of order 1
1138 @findex @code{BESY1} intrinsic
1139 @findex @code{DBESY1} intrinsic
1140 @cindex Bessel
1141
1142 @table @asis
1143 @item @emph{Description}:
1144 @code{BESY1(X)} computes the Bessel function of the second kind of order 1
1145 of @var{X}.
1146
1147 @item @emph{Option}:
1148 gnu
1149
1150 @item @emph{Class}:
1151 elemental function
1152
1153 @item @emph{Syntax}:
1154 @code{X = BESY1(X)}
1155
1156 @item @emph{Arguments}:
1157 @multitable @columnfractions .15 .80
1158 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1159 @end multitable
1160
1161 @item @emph{Return value}:
1162 The return value is a scalar of type @code{REAL(*)}.
1163
1164 @item @emph{Example}:
1165 @smallexample
1166 program test_besy1
1167   real(8) :: x = 1.0_8
1168   x = besy1(x)
1169 end program test_besy1
1170 @end smallexample
1171
1172 @item @emph{Specific names}:
1173 @multitable @columnfractions .24 .24 .24 .24
1174 @item Name            @tab Argument          @tab Return type       @tab Option
1175 @item @code{DBESY1(X)}@tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab gnu
1176 @end multitable
1177 @end table
1178
1179
1180
1181 @node BESYN
1182 @section @code{BESYN} --- Bessel function of the second kind
1183 @findex @code{BESYN} intrinsic
1184 @findex @code{DBESYN} intrinsic
1185 @cindex Bessel
1186
1187 @table @asis
1188 @item @emph{Description}:
1189 @code{BESYN(N, X)} computes the Bessel function of the second kind of order
1190 @var{N} of @var{X}.
1191
1192 @item @emph{Option}:
1193 gnu
1194
1195 @item @emph{Class}:
1196 elemental function
1197
1198 @item @emph{Syntax}:
1199 @code{Y = BESYN(N, X)}
1200
1201 @item @emph{Arguments}:
1202 @multitable @columnfractions .15 .80
1203 @item @var{N} @tab The type shall be @code{INTEGER(*)}, and it shall be scalar.
1204 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
1205 @end multitable
1206
1207 @item @emph{Return value}:
1208 The return value is a scalar of type @code{REAL(*)}.
1209
1210 @item @emph{Example}:
1211 @smallexample
1212 program test_besyn
1213   real(8) :: x = 1.0_8
1214   x = besyn(5,x)
1215 end program test_besyn
1216 @end smallexample
1217
1218 @item @emph{Specific names}:
1219 @multitable @columnfractions .24 .24 .24 .24
1220 @item Name               @tab Argument            @tab Return type     @tab Option
1221 @item @code{DBESYN(N,X)} @tab @code{INTEGER(*) N} @tab @code{REAL(8)}  @tab gnu
1222 @item                    @tab @code{REAL(8)    X} @tab                 @tab 
1223 @end multitable
1224 @end table
1225
1226
1227
1228 @node BIT_SIZE
1229 @section @code{BIT_SIZE} --- Bit size inquiry function
1230 @findex @code{BIT_SIZE} intrinsic
1231 @cindex bit_size
1232
1233 @table @asis
1234 @item @emph{Description}:
1235 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
1236 represented by the type of @var{I}.
1237
1238 @item @emph{Option}:
1239 f95, gnu
1240
1241 @item @emph{Class}:
1242 elemental function
1243
1244 @item @emph{Syntax}:
1245 @code{I = BIT_SIZE(I)}
1246
1247 @item @emph{Arguments}:
1248 @multitable @columnfractions .15 .80
1249 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1250 @end multitable
1251
1252 @item @emph{Return value}:
1253 The return value is of type @code{INTEGER(*)}
1254
1255 @item @emph{Example}:
1256 @smallexample
1257 program test_bit_size
1258     integer :: i = 123
1259     integer :: size
1260     size = bit_size(i)
1261     print *, size
1262 end program test_bit_size
1263 @end smallexample
1264 @end table
1265
1266
1267
1268 @node BTEST
1269 @section @code{BTEST} --- Bit test function
1270 @findex @code{BTEST} intrinsic
1271 @cindex BTEST
1272
1273 @table @asis
1274 @item @emph{Description}:
1275 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
1276 in @var{I} is set.
1277
1278 @item @emph{Option}:
1279 f95, gnu
1280
1281 @item @emph{Class}:
1282 elemental function
1283
1284 @item @emph{Syntax}:
1285 @code{I = BTEST(I,POS)}
1286
1287 @item @emph{Arguments}:
1288 @multitable @columnfractions .15 .80
1289 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1290 @item @var{POS} @tab The type shall be @code{INTEGER(*)}.
1291 @end multitable
1292
1293 @item @emph{Return value}:
1294 The return value is of type @code{LOGICAL}
1295
1296 @item @emph{Example}:
1297 @smallexample
1298 program test_btest
1299     integer :: i = 32768 + 1024 + 64
1300     integer :: pos
1301     logical :: bool
1302     do pos=0,16
1303         bool = btest(i, pos) 
1304         print *, pos, bool
1305     end do
1306 end program test_btest
1307 @end smallexample
1308 @end table
1309
1310
1311
1312 @node CEILING
1313 @section @code{CEILING} --- Integer ceiling function
1314 @findex @code{CEILING} intrinsic
1315 @cindex CEILING
1316
1317 @table @asis
1318 @item @emph{Description}:
1319 @code{CEILING(X)} returns the least integer greater than or equal to @var{X}.
1320
1321 @item @emph{Option}:
1322 f95, gnu
1323
1324 @item @emph{Class}:
1325 elemental function
1326
1327 @item @emph{Syntax}:
1328 @code{I = CEILING(X[,KIND])}
1329
1330 @item @emph{Arguments}:
1331 @multitable @columnfractions .15 .80
1332 @item @var{X} @tab The type shall be @code{REAL(*)}.
1333 @item @var{KIND} @tab Optional scaler integer initialization expression.
1334 @end multitable
1335
1336 @item @emph{Return value}:
1337 The return value is of type @code{INTEGER(KIND)}
1338
1339 @item @emph{Example}:
1340 @smallexample
1341 program test_ceiling
1342     real :: x = 63.29
1343     real :: y = -63.59
1344     print *, ceiling(x) ! returns 64
1345     print *, ceiling(y) ! returns -63
1346 end program test_ceiling
1347 @end smallexample
1348 @end table
1349
1350
1351
1352 @node CHAR
1353 @section @code{CHAR} --- Character conversion function
1354 @findex @code{CHAR} intrinsic
1355 @cindex CHAR
1356
1357 @table @asis
1358 @item @emph{Description}:
1359 @code{CHAR(I,[KIND])} returns the character represented by the integer @var{I}.
1360
1361 @item @emph{Option}:
1362 f95, gnu
1363
1364 @item @emph{Class}:
1365 elemental function
1366
1367 @item @emph{Syntax}:
1368 @code{C = CHAR(I[,KIND])}
1369
1370 @item @emph{Arguments}:
1371 @multitable @columnfractions .15 .80
1372 @item @var{I} @tab The type shall be @code{INTEGER(*)}.
1373 @item @var{KIND} @tab Optional scaler integer initialization expression.
1374 @end multitable
1375
1376 @item @emph{Return value}:
1377 The return value is of type @code{CHARACTER(1)}
1378
1379 @item @emph{Example}:
1380 @smallexample
1381 program test_char
1382     integer :: i = 74
1383     character(1) :: c
1384     c = char(i)
1385     print *, i, c ! returns 'J'
1386 end program test_char
1387 @end smallexample
1388 @end table
1389
1390
1391
1392 @node CMPLX
1393 @section @code{CMPLX} --- Complex conversion function
1394 @findex @code{CMPLX} intrinsic
1395 @cindex CMPLX
1396
1397 @table @asis
1398 @item @emph{Description}:
1399 @code{CMPLX(X,[Y,KIND])} returns a complex number where @var{X} is converted to
1400 the real component.  If @var{Y} is present it is converted to the imaginary
1401 component.  If @var{Y} is not present then the imaginary component is set to
1402 0.0.  If @var{X} is complex then @var{Y} must not be present.
1403
1404 @item @emph{Option}:
1405 f95, gnu
1406
1407 @item @emph{Class}:
1408 elemental function
1409
1410 @item @emph{Syntax}:
1411 @code{C = CMPLX(X[,Y,KIND])}
1412
1413 @item @emph{Arguments}:
1414 @multitable @columnfractions .15 .80
1415 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1416 @item @var{Y} @tab Optional, allowed if @var{X} is not @code{COMPLEX(*)}.  May be @code{INTEGER(*)} or @code{REAL(*)}. 
1417 @item @var{KIND} @tab Optional scaler integer initialization expression.
1418 @end multitable
1419
1420 @item @emph{Return value}:
1421 The return value is of type @code{COMPLEX(*)}
1422
1423 @item @emph{Example}:
1424 @smallexample
1425 program test_cmplx
1426     integer :: i = 42
1427     real :: x = 3.14
1428     complex :: z
1429     z = cmplx(i, x)
1430     print *, z, cmplx(x)
1431 end program test_cmplx
1432 @end smallexample
1433 @end table
1434
1435
1436
1437 @node COMMAND_ARGUMENT_COUNT
1438 @section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function 
1439 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
1440 @cindex command argument count
1441
1442 @table @asis
1443 @item @emph{Description}:
1444 @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the
1445 command line when the containing program was invoked.
1446
1447 @item @emph{Option}:
1448 f2003, gnu
1449
1450 @item @emph{Class}:
1451 non-elemental function
1452
1453 @item @emph{Syntax}:
1454 @code{I = COMMAND_ARGUMENT_COUNT()}
1455
1456 @item @emph{Arguments}:
1457 @multitable @columnfractions .15 .80
1458 @item None
1459 @end multitable
1460
1461 @item @emph{Return value}:
1462 The return value is of type @code{INTEGER(4)}
1463
1464 @item @emph{Example}:
1465 @smallexample
1466 program test_command_argument_count
1467     integer :: count
1468     count = command_argument_count()
1469     print *, count
1470 end program test_command_argument_count
1471 @end smallexample
1472 @end table
1473
1474
1475
1476 @node CONJG
1477 @section @code{CONJG} --- Complex conjugate function 
1478 @findex @code{CONJG} intrinsic
1479 @findex @code{DCONJG} intrinsic
1480 @cindex complex conjugate
1481 @table @asis
1482 @item @emph{Description}:
1483 @code{CONJG(Z)} returns the conjugate of @var{Z}.  If @var{Z} is @code{(x, y)}
1484 then the result is @code{(x, -y)}
1485
1486 @item @emph{Option}:
1487 f95, gnu
1488
1489 @item @emph{Class}:
1490 elemental function
1491
1492 @item @emph{Syntax}:
1493 @code{Z = CONJG(Z)}
1494
1495 @item @emph{Arguments}:
1496 @multitable @columnfractions .15 .80
1497 @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
1498 @end multitable
1499
1500 @item @emph{Return value}:
1501 The return value is of type @code{COMPLEX(*)}.
1502
1503 @item @emph{Example}:
1504 @smallexample
1505 program test_conjg
1506     complex :: z = (2.0, 3.0)
1507     complex(8) :: dz = (2.71_8, -3.14_8)
1508     z= conjg(z)
1509     print *, z
1510     dz = dconjg(dz)
1511     print *, dz
1512 end program test_conjg
1513 @end smallexample
1514
1515 @item @emph{Specific names}:
1516 @multitable @columnfractions .24 .24 .24 .24
1517 @item Name             @tab Argument             @tab Return type          @tab Option
1518 @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z}  @tab @code{COMPLEX(8)}    @tab gnu
1519 @end multitable
1520 @end table
1521
1522
1523
1524 @node COS
1525 @section @code{COS} --- Cosine function 
1526 @findex @code{COS} intrinsic
1527 @findex @code{DCOS} intrinsic
1528 @findex @code{ZCOS} intrinsic
1529 @findex @code{CDCOS} intrinsic
1530 @cindex cosine
1531
1532 @table @asis
1533 @item @emph{Description}:
1534 @code{COS(X)} computes the cosine of @var{X}.
1535
1536 @item @emph{Option}:
1537 f95, gnu
1538
1539 @item @emph{Class}:
1540 elemental function
1541
1542 @item @emph{Syntax}:
1543 @code{X = COS(X)}
1544
1545 @item @emph{Arguments}:
1546 @multitable @columnfractions .15 .80
1547 @item @var{X} @tab The type shall be @code{REAL(*)} or
1548 @code{COMPLEX(*)}.
1549 @end multitable
1550
1551 @item @emph{Return value}:
1552 The return value has the same type and kind as @var{X}.
1553
1554 @item @emph{Example}:
1555 @smallexample
1556 program test_cos
1557   real :: x = 0.0
1558   x = cos(x)
1559 end program test_cos
1560 @end smallexample
1561
1562 @item @emph{Specific names}:
1563 @multitable @columnfractions .24 .24 .24 .24
1564 @item Name            @tab Argument          @tab Return type     @tab Option
1565 @item @code{DCOS(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}  @tab f95, gnu
1566 @item @code{CCOS(X)}@tab @code{COMPLEX(4) X}@tab @code{COMPLEX(4)}@tab f95, gnu
1567 @item @code{ZCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu
1568 @item @code{CDCOS(X)}@tab @code{COMPLEX(8) X}@tab @code{COMPLEX(8)}@tab f95, gnu
1569 @end multitable
1570 @end table
1571
1572
1573
1574 @node COSH
1575 @section @code{COSH} --- Hyperbolic cosine function 
1576 @findex @code{COSH} intrinsic
1577 @findex @code{DCOSH} intrinsic
1578 @cindex hyperbolic cosine
1579
1580 @table @asis
1581 @item @emph{Description}:
1582 @code{COSH(X)} computes the hyperbolic cosine of @var{X}.
1583
1584 @item @emph{Option}:
1585 f95, gnu
1586
1587 @item @emph{Class}:
1588 elemental function
1589
1590 @item @emph{Syntax}:
1591 @code{X = COSH(X)}
1592
1593 @item @emph{Arguments}:
1594 @multitable @columnfractions .15 .80
1595 @item @var{X} @tab The type shall be @code{REAL(*)}.
1596 @end multitable
1597
1598 @item @emph{Return value}:
1599 The return value is of type @code{REAL(*)} and it is positive
1600 (@math{ \cosh (x) \geq 0 }.
1601
1602 @item @emph{Example}:
1603 @smallexample
1604 program test_cosh
1605   real(8) :: x = 1.0_8
1606   x = cosh(x)
1607 end program test_cosh
1608 @end smallexample
1609
1610 @item @emph{Specific names}:
1611 @multitable @columnfractions .24 .24 .24 .24
1612 @item Name            @tab Argument          @tab Return type       @tab Option
1613 @item @code{DCOSH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
1614 @end multitable
1615 @end table
1616
1617
1618
1619 @node COUNT
1620 @section @code{COUNT} --- Count function
1621 @findex @code{COUNT} intrinsic
1622 @cindex count
1623
1624 @table @asis
1625 @item @emph{Description}:
1626 @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of
1627 @var{MASK} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
1628 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
1629 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
1630
1631 @item @emph{Option}:
1632 f95, gnu
1633
1634 @item @emph{Class}:
1635 transformational function
1636
1637 @item @emph{Syntax}:
1638 @code{I = COUNT(MASK[,DIM])}
1639
1640 @item @emph{Arguments}:
1641 @multitable @columnfractions .15 .80
1642 @item @var{MASK} @tab The type shall be @code{LOGICAL}.
1643 @item @var{DIM}  @tab The type shall be @code{INTEGER}.
1644 @end multitable
1645
1646 @item @emph{Return value}:
1647 The return value is of type @code{INTEGER} with rank equal to that of
1648 @var{MASK}.
1649
1650 @item @emph{Example}:
1651 @smallexample
1652 program test_count
1653     integer, dimension(2,3) :: a, b
1654     logical, dimension(2,3) :: mask
1655     a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
1656     b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
1657     print '(3i3)', a(1,:)
1658     print '(3i3)', a(2,:)
1659     print *
1660     print '(3i3)', b(1,:)
1661     print '(3i3)', b(2,:)
1662     print *
1663     mask = a.ne.b
1664     print '(3l3)', mask(1,:)
1665     print '(3l3)', mask(2,:)
1666     print *
1667     print '(3i3)', count(mask)
1668     print *
1669     print '(3i3)', count(mask, 1)
1670     print *
1671     print '(3i3)', count(mask, 2)
1672 end program test_count
1673 @end smallexample
1674 @end table
1675
1676
1677
1678 @node CPU_TIME
1679 @section @code{CPU_TIME} --- CPU elapsed time in seconds
1680 @findex @code{CPU_TIME} intrinsic
1681 @cindex CPU_TIME
1682
1683 @table @asis
1684 @item @emph{Description}:
1685 Returns a @code{REAL} value representing the elapsed CPU time in seconds.  This
1686 is useful for testing segments of code to determine execution time.
1687
1688 @item @emph{Option}:
1689 f95, gnu
1690
1691 @item @emph{Class}:
1692 subroutine
1693
1694 @item @emph{Syntax}:
1695 @code{CPU_TIME(X)}
1696
1697 @item @emph{Arguments}:
1698 @multitable @columnfractions .15 .80
1699 @item @var{X} @tab The type shall be @code{REAL} with intent out.
1700 @end multitable
1701
1702 @item @emph{Return value}:
1703 None
1704
1705 @item @emph{Example}:
1706 @smallexample
1707 program test_cpu_time
1708     real :: start, finish
1709     call cpu_time(start)
1710         ! put code to test here
1711     call cpu_time(finish)
1712     print '("Time = ",f6.3," seconds.")',finish-start
1713 end program test_cpu_time
1714 @end smallexample
1715 @end table
1716
1717
1718
1719 @node CSHIFT
1720 @section @code{CSHIFT} --- Circular shift function
1721 @findex @code{CSHIFT} intrinsic
1722 @cindex cshift intrinsic
1723
1724 @table @asis
1725 @item @emph{Description}:
1726 @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of
1727 @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
1728 taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
1729 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
1730 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
1731 by @var{SHIFT} places.  If rank is greater than one, then all complete rank one
1732 sections of @var{ARRAY} along the given dimension are shifted.  Elements
1733 shifted out one end of each rank one section are shifted back in the other end.
1734
1735 @item @emph{Option}:
1736 f95, gnu
1737
1738 @item @emph{Class}:
1739 transformational function
1740
1741 @item @emph{Syntax}:
1742 @code{A = CSHIFT(A, SHIFT[,DIM])}
1743
1744 @item @emph{Arguments}:
1745 @multitable @columnfractions .15 .80
1746 @item @var{ARRAY}  @tab May be any type, not scaler.
1747 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
1748 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
1749 @end multitable
1750
1751 @item @emph{Return value}:
1752 Returns an array of same type and rank as the @var{ARRAY} argument.
1753
1754 @item @emph{Example}:
1755 @smallexample
1756 program test_cshift
1757     integer, dimension(3,3) :: a
1758     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
1759     print '(3i3)', a(1,:)
1760     print '(3i3)', a(2,:)
1761     print '(3i3)', a(3,:)    
1762     a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
1763     print *
1764     print '(3i3)', a(1,:)
1765     print '(3i3)', a(2,:)
1766     print '(3i3)', a(3,:)
1767 end program test_cshift
1768 @end smallexample
1769 @end table
1770
1771
1772
1773 @node DATE_AND_TIME
1774 @section @code{DATE_AND_TIME} --- Date and time subroutine
1775 @findex @code{DATE_AND_TIME} intrinsic
1776 @cindex DATE_AND_TIME
1777
1778 @table @asis
1779 @item @emph{Description}:
1780 @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and
1781 time information from the real-time system clock.  @var{DATE} is
1782 @code{INTENT(OUT)} and has form ccyymmdd.  @var{TIME} is @code{INTENT(OUT)} and
1783 has form hhmmss.sss.  @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm,
1784 representing the difference with respect to Coordinated Universal Time (UTC).
1785 Unavailable time and date parameters return blanks.
1786
1787 @var{VALUES} is @code{INTENT(OUT)} and provides the following:
1788
1789 @multitable @columnfractions .15 .30 .60
1790 @item @tab @code{VALUE(1)}: @tab The year
1791 @item @tab @code{VALUE(2)}: @tab The month
1792 @item @tab @code{VALUE(3)}: @tab The day of the month
1793 @item @tab @code{VAlUE(4)}: @tab Time difference with UTC in minutes
1794 @item @tab @code{VALUE(5)}: @tab The hour of the day
1795 @item @tab @code{VALUE(6)}: @tab The minutes of the hour
1796 @item @tab @code{VALUE(7)}: @tab The seconds of the minute
1797 @item @tab @code{VALUE(8)}: @tab The milliseconds of the second
1798 @end multitable     
1799
1800 @item @emph{Option}:
1801 f95, gnu
1802
1803 @item @emph{Class}:
1804 subroutine
1805
1806 @item @emph{Syntax}:
1807 @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
1808
1809 @item @emph{Arguments}:
1810 @multitable @columnfractions .15 .80
1811 @item @var{DATE}  @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
1812 @item @var{TIME}  @tab (Optional) The type shall be @code{CHARACTER(10)} or larger.
1813 @item @var{ZONE}  @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
1814 @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
1815 @end multitable
1816
1817 @item @emph{Return value}:
1818 None
1819
1820 @item @emph{Example}:
1821 @smallexample
1822 program test_time_and_date
1823     character(8)  :: date
1824     character(10) :: time
1825     character(5)  :: zone
1826     integer,dimension(8) :: values
1827     ! using keyword arguments
1828     call date_and_time(date,time,zone,values)
1829     call date_and_time(DATE=date,ZONE=zone)
1830     call date_and_time(TIME=time)
1831     call date_and_time(VALUES=values)
1832     print '(a,2x,a,2x,a)', date, time, zone
1833     print '(8i5))', values
1834 end program test_time_and_date
1835 @end smallexample
1836 @end table
1837
1838
1839
1840 @node DBLE
1841 @section @code{DBLE} --- Double conversion function 
1842 @findex @code{DBLE} intrinsic
1843 @cindex double conversion
1844
1845 @table @asis
1846 @item @emph{Description}:
1847 @code{DBLE(X)} Converts @var{X} to double precision real type.
1848 @code{DFLOAT} is an alias for @code{DBLE}
1849
1850 @item @emph{Option}:
1851 f95, gnu
1852
1853 @item @emph{Class}:
1854 elemental function
1855
1856 @item @emph{Syntax}:
1857 @code{X = DBLE(X)}
1858 @code{X = DFLOAT(X)}
1859
1860 @item @emph{Arguments}:
1861 @multitable @columnfractions .15 .80
1862 @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1863 @end multitable
1864
1865 @item @emph{Return value}:
1866 The return value is of type double precision real.
1867
1868 @item @emph{Example}:
1869 @smallexample
1870 program test_dble
1871     real    :: x = 2.18
1872     integer :: i = 5
1873     complex :: z = (2.3,1.14)
1874     print *, dble(x), dble(i), dfloat(z)
1875 end program test_dble
1876 @end smallexample
1877 @end table
1878
1879
1880
1881 @node DCMPLX
1882 @section @code{DCMPLX} --- Double complex conversion function
1883 @findex @code{DCMPLX} intrinsic
1884 @cindex DCMPLX
1885
1886 @table @asis
1887 @item @emph{Description}:
1888 @code{DCMPLX(X [,Y])} returns a double complex number where @var{X} is
1889 converted to the real component.  If @var{Y} is present it is converted to the
1890 imaginary component.  If @var{Y} is not present then the imaginary component is
1891 set to 0.0.  If @var{X} is complex then @var{Y} must not be present.
1892
1893 @item @emph{Option}:
1894 f95, gnu
1895
1896 @item @emph{Class}:
1897 elemental function
1898
1899 @item @emph{Syntax}:
1900 @code{C = DCMPLX(X)}
1901 @code{C = DCMPLX(X,Y)}
1902
1903 @item @emph{Arguments}:
1904 @multitable @columnfractions .15 .80
1905 @item @var{X} @tab The type may be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
1906 @item @var{Y} @tab Optional if @var{X} is not @code{COMPLEX(*)}. May be @code{INTEGER(*)} or @code{REAL(*)}. 
1907 @end multitable
1908
1909 @item @emph{Return value}:
1910 The return value is of type @code{COMPLEX(8)}
1911
1912 @item @emph{Example}:
1913 @smallexample
1914 program test_dcmplx
1915     integer :: i = 42
1916     real :: x = 3.14
1917     complex :: z
1918     z = cmplx(i, x)
1919     print *, dcmplx(i)
1920     print *, dcmplx(x)
1921     print *, dcmplx(z)
1922     print *, dcmplx(x,i)
1923 end program test_dcmplx
1924 @end smallexample
1925 @end table
1926
1927
1928
1929 @node DFLOAT
1930 @section @code{DFLOAT} --- Double conversion function 
1931 @findex @code{DFLOAT} intrinsic
1932 @cindex double float conversion
1933
1934 @table @asis
1935 @item @emph{Description}:
1936 @code{DFLOAT(X)} Converts @var{X} to double precision real type.
1937 @code{DFLOAT} is an alias for @code{DBLE}.  See @code{DBLE}.
1938 @end table
1939
1940
1941
1942 @node DIGITS
1943 @section @code{DIGITS} --- Significant digits function
1944 @findex @code{DIGITS} intrinsic
1945 @cindex digits, significant
1946
1947 @table @asis
1948 @item @emph{Description}:
1949 @code{DIGITS(X)} returns the number of significant digits of the internal model
1950 representation of @var{X}.  For example, on a system using a 32-bit
1951 floating point representation, a default real number would likely return 24.
1952
1953 @item @emph{Option}:
1954 f95, gnu
1955
1956 @item @emph{Class}:
1957 inquiry function
1958
1959 @item @emph{Syntax}:
1960 @code{C = DIGITS(X)}
1961
1962 @item @emph{Arguments}:
1963 @multitable @columnfractions .15 .80
1964 @item @var{X} @tab The type may be @code{INTEGER(*)} or @code{REAL(*)}.
1965 @end multitable
1966
1967 @item @emph{Return value}:
1968 The return value is of type @code{INTEGER}.
1969
1970 @item @emph{Example}:
1971 @smallexample
1972 program test_digits
1973     integer :: i = 12345
1974     real :: x = 3.143
1975     real(8) :: y = 2.33
1976     print *, digits(i)
1977     print *, digits(x)
1978     print *, digits(y)
1979 end program test_digits
1980 @end smallexample
1981 @end table
1982
1983
1984
1985 @node DIM
1986 @section @code{DIM} --- Dim function
1987 @findex @code{DIM} intrinsic
1988 @findex @code{IDIM} intrinsic
1989 @findex @code{DDIM} intrinsic
1990 @cindex dim
1991
1992 @table @asis
1993 @item @emph{Description}:
1994 @code{DIM(X,Y)} returns the difference @code{X-Y} if the result is positive;
1995 otherwise returns zero.
1996
1997 @item @emph{Option}:
1998 f95, gnu
1999
2000 @item @emph{Class}:
2001 elemental function
2002
2003 @item @emph{Syntax}:
2004 @code{X = DIM(X,Y)}
2005
2006 @item @emph{Arguments}:
2007 @multitable @columnfractions .15 .80
2008 @item @var{X} @tab The type shall be @code{INTEGER(*)} or @code{REAL(*)}
2009 @item @var{Y} @tab The type shall be the same type and kind as @var{X}.
2010 @end multitable
2011
2012 @item @emph{Return value}:
2013 The return value is of type @code{INTEGER(*)} or @code{REAL(*)}.
2014
2015 @item @emph{Example}:
2016 @smallexample
2017 program test_dim
2018     integer :: i
2019     real(8) :: x
2020     i = dim(4, 15)
2021     x = dim(4.345_8, 2.111_8)
2022     print *, i
2023     print *, x
2024 end program test_dim
2025 @end smallexample
2026
2027 @item @emph{Specific names}:
2028 @multitable @columnfractions .24 .24 .24 .24
2029 @item Name            @tab Argument          @tab Return type       @tab Option
2030 @item @code{IDIM(X,Y)} @tab @code{INTEGER(4) X,Y} @tab @code{INTEGER(4)} @tab gnu
2031 @item @code{DDIM(X,Y)} @tab @code{REAL(8) X,Y}  @tab @code{REAL(8)} @tab gnu
2032 @end multitable
2033 @end table
2034
2035
2036
2037 @node DOT_PRODUCT
2038 @section @code{DOT_PRODUCT} --- Dot product function
2039 @findex @code{DOT_PRODUCT} intrinsic
2040 @cindex Dot product
2041
2042 @table @asis
2043 @item @emph{Description}:
2044 @code{DOT_PRODUCT(X,Y)} computes the dot product multiplication of two vectors
2045 @var{X} and @var{Y}.  The two vectors may be either numeric or logical
2046 and must be arrays of rank one and of equal size. If the vectors are
2047 @code{INTEGER(*)} or @code{REAL(*)}, the result is @code{SUM(X*Y)}. If the
2048 vectors are @code{COMPLEX(*)}, the result is @code{SUM(CONJG(X)*Y)}. If the 
2049 vectors are @code{LOGICAL}, the result is @code{ANY(X.AND.Y)}.
2050
2051 @item @emph{Option}:
2052 f95
2053
2054 @item @emph{Class}:
2055 transformational function
2056
2057 @item @emph{Syntax}:
2058 @code{S = DOT_PRODUCT(X,Y)}
2059
2060 @item @emph{Arguments}:
2061 @multitable @columnfractions .15 .80
2062 @item @var{X} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2063 @item @var{Y} @tab The type shall be numeric or @code{LOGICAL}, rank 1.
2064 @end multitable
2065
2066 @item @emph{Return value}:
2067 If the arguments are numeric, the return value is a scaler of numeric type,
2068 @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.  If the arguments are
2069 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
2070
2071 @item @emph{Example}:
2072 @smallexample
2073 program test_dot_prod
2074     integer, dimension(3) :: a, b
2075     a = (/ 1, 2, 3 /)
2076     b = (/ 4, 5, 6 /)
2077     print '(3i3)', a
2078     print *
2079     print '(3i3)', b
2080     print *
2081     print *, dot_product(a,b)
2082 end program test_dot_prod
2083 @end smallexample
2084 @end table
2085
2086
2087
2088 @node DPROD
2089 @section @code{DPROD} --- Double product function
2090 @findex @code{DPROD} intrinsic
2091 @cindex Double product
2092
2093 @table @asis
2094 @item @emph{Description}:
2095 @code{DPROD(X,Y)} returns the product @code{X*Y}.
2096
2097 @item @emph{Option}:
2098 f95, gnu
2099
2100 @item @emph{Class}:
2101 elemental function
2102
2103 @item @emph{Syntax}:
2104 @code{D = DPROD(X,Y)}
2105
2106 @item @emph{Arguments}:
2107 @multitable @columnfractions .15 .80
2108 @item @var{X} @tab The type shall be @code{REAL}.
2109 @item @var{Y} @tab The type shall be @code{REAL}.
2110 @end multitable
2111
2112 @item @emph{Return value}:
2113 The return value is of type @code{REAL(8)}.
2114
2115 @item @emph{Example}:
2116 @smallexample
2117 program test_dprod
2118     integer :: i
2119     real :: x = 5.2
2120     real :: y = 2.3
2121     real(8) :: d
2122     d = dprod(x,y)
2123     print *, d
2124 end program test_dprod
2125 @end smallexample
2126 @end table
2127
2128
2129
2130 @node DREAL
2131 @section @code{DREAL} --- Double real part function
2132 @findex @code{DREAL} intrinsic
2133 @cindex Double real part
2134
2135 @table @asis
2136 @item @emph{Description}:
2137 @code{DREAL(Z)} returns the real part of complex variable @var{Z}.
2138
2139 @item @emph{Option}:
2140 gnu
2141
2142 @item @emph{Class}:
2143 elemental function
2144
2145 @item @emph{Syntax}:
2146 @code{D = DREAL(Z)}
2147
2148 @item @emph{Arguments}:
2149 @multitable @columnfractions .15 .80
2150 @item @var{Z} @tab The type shall be @code{COMPLEX(8)}.
2151 @end multitable
2152
2153 @item @emph{Return value}:
2154 The return value is of type @code{REAL(8)}.
2155
2156 @item @emph{Example}:
2157 @smallexample
2158 program test_dreal
2159     complex(8) :: z = (1.3_8,7.2_8)
2160     print *, dreal(z)
2161 end program test_dreal
2162 @end smallexample
2163 @end table
2164
2165
2166
2167 @node DTIME
2168 @section @code{DTIME} --- Execution time subroutine (or function)
2169 @findex @code{DTIME} intrinsic
2170 @cindex dtime subroutine 
2171
2172 @table @asis
2173 @item @emph{Description}:
2174 @code{DTIME(TARRAY, RESULT)} initially returns the number of seconds of runtime
2175 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
2176 returns the user and system components of this time in @code{TARRAY(1)} and
2177 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) +
2178 TARRAY(2)}.
2179
2180 Subsequent invocations of @code{DTIME} return values accumulated since the
2181 previous invocation.
2182
2183 On some systems, the underlying timings are represented using types with
2184 sufficiently small limits that overflows (wraparounds) are possible, such as
2185 32-bit types. Therefore, the values returned by this intrinsic might be, or
2186 become, negative, or numerically less than previous values, during a single
2187 run of the compiled program.
2188
2189 If @code{DTIME} is invoked as a function, it can not be invoked as a
2190 subroutine, and vice versa.
2191
2192 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2193
2194 @multitable @columnfractions .15 .30 .60
2195 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2196 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2197 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2198 @end multitable
2199
2200 @item @emph{Option}:
2201 gnu
2202
2203 @item @emph{Class}:
2204 subroutine
2205
2206 @item @emph{Syntax}:
2207 @multitable @columnfractions .80
2208 @item @code{CALL DTIME(TARRAY, RESULT)}.
2209 @item @code{RESULT = DTIME(TARRAY)}, (not recommended).
2210 @end multitable
2211
2212 @item @emph{Arguments}:
2213 @multitable @columnfractions .15 .80
2214 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2215 @item @var{RESULT}@tab The type shall be @code{REAL}.
2216 @end multitable
2217
2218 @item @emph{Return value}:
2219 Elapsed time in seconds since the start of program execution.
2220
2221 @item @emph{Example}:
2222 @smallexample
2223 program test_dtime
2224     integer(8) :: i, j
2225     real, dimension(2) :: tarray
2226     real :: result
2227     call dtime(tarray, result)
2228     print *, result
2229     print *, tarray(1)
2230     print *, tarray(2)   
2231     do i=1,100000000    ! Just a delay
2232         j = i * i - i
2233     end do
2234     call dtime(tarray, result)
2235     print *, result
2236     print *, tarray(1)
2237     print *, tarray(2)
2238 end program test_dtime
2239 @end smallexample
2240 @end table
2241
2242
2243
2244 @node EOSHIFT
2245 @section @code{EOSHIFT} --- End-off shift function
2246 @findex @code{EOSHIFT} intrinsic
2247 @cindex eoshift intrinsic
2248
2249 @table @asis
2250 @item @emph{Description}:
2251 @code{EOSHIFT(ARRAY, SHIFT[,BOUNDARY, DIM])} performs an end-off shift on
2252 elements of @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is
2253 omitted it is taken to be @code{1}.  @var{DIM} is a scaler of type
2254 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
2255 rank of @var{ARRAY}.  If the rank of @var{ARRAY} is one, then all elements of
2256 @var{ARRAY} are shifted by @var{SHIFT} places.  If rank is greater than one,
2257 then all complete rank one sections of @var{ARRAY} along the given dimension are
2258 shifted.  Elements shifted out one end of each rank one section are dropped.  If
2259 @var{BOUNDARY} is present then the corresponding value of from @var{BOUNDARY}
2260 is copied back in the other end.  If @var{BOUNDARY} is not present then the
2261 following are copied in depending on the type of @var{ARRAY}.
2262
2263 @multitable @columnfractions .15 .80
2264 @item @emph{Array Type} @tab @emph{Boundary Value}
2265 @item Numeric  @tab 0 of the type and kind of @var{ARRAY}.
2266 @item Logical  @tab @code{.FALSE.}.
2267 @item Character(@var{len}) @tab @var{len} blanks.
2268 @end multitable
2269
2270 @item @emph{Option}:
2271 f95, gnu
2272
2273 @item @emph{Class}:
2274 transformational function
2275
2276 @item @emph{Syntax}:
2277 @code{A = EOSHIFT(A, SHIFT[,BOUNDARY, DIM])}
2278
2279 @item @emph{Arguments}:
2280 @multitable @columnfractions .15 .80
2281 @item @var{ARRAY}  @tab May be any type, not scaler.
2282 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
2283 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}. 
2284 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
2285 @end multitable
2286
2287 @item @emph{Return value}:
2288 Returns an array of same type and rank as the @var{ARRAY} argument.
2289
2290 @item @emph{Example}:
2291 @smallexample
2292 program test_eoshift
2293     integer, dimension(3,3) :: a
2294     a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
2295     print '(3i3)', a(1,:)
2296     print '(3i3)', a(2,:)
2297     print '(3i3)', a(3,:)    
2298     a = EOSHIFT(a, SHIFT=(/1, 2, 1/), BOUNDARY=-5, DIM=2)
2299     print *
2300     print '(3i3)', a(1,:)
2301     print '(3i3)', a(2,:)
2302     print '(3i3)', a(3,:)
2303 end program test_eoshift
2304 @end smallexample
2305 @end table
2306
2307
2308
2309 @node EPSILON
2310 @section @code{EPSILON} --- Epsilon function
2311 @findex @code{EPSILON} intrinsic
2312 @cindex epsilon, significant
2313
2314 @table @asis
2315 @item @emph{Description}:
2316 @code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
2317
2318 @item @emph{Option}:
2319 f95, gnu
2320
2321 @item @emph{Class}:
2322 inquiry function
2323
2324 @item @emph{Syntax}:
2325 @code{C = EPSILON(X)}
2326
2327 @item @emph{Arguments}:
2328 @multitable @columnfractions .15 .80
2329 @item @var{X} @tab The type shall be @code{REAL(*)}.
2330 @end multitable
2331
2332 @item @emph{Return value}:
2333 The return value is of same type as the argument.
2334
2335 @item @emph{Example}:
2336 @smallexample
2337 program test_epsilon
2338     real :: x = 3.143
2339     real(8) :: y = 2.33
2340     print *, EPSILON(x)
2341     print *, EPSILON(y)
2342 end program test_epsilon
2343 @end smallexample
2344 @end table
2345
2346
2347
2348 @node ERF
2349 @section @code{ERF} --- Error function 
2350 @findex @code{ERF} intrinsic
2351 @cindex error function
2352
2353 @table @asis
2354 @item @emph{Description}:
2355 @code{ERF(X)} computes the error function of @var{X}.
2356
2357 @item @emph{Option}:
2358 gnu
2359
2360 @item @emph{Class}:
2361 elemental function
2362
2363 @item @emph{Syntax}:
2364 @code{X = ERF(X)}
2365
2366 @item @emph{Arguments}:
2367 @multitable @columnfractions .15 .80
2368 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2369 @end multitable
2370
2371 @item @emph{Return value}:
2372 The return value is a scalar of type @code{REAL(*)} and it is positive
2373 (@math{ - 1 \leq erf (x) \leq 1 }.
2374
2375 @item @emph{Example}:
2376 @smallexample
2377 program test_erf
2378   real(8) :: x = 0.17_8
2379   x = erf(x)
2380 end program test_erf
2381 @end smallexample
2382
2383 @item @emph{Specific names}:
2384 @multitable @columnfractions .24 .24 .24 .24
2385 @item Name            @tab Argument          @tab Return type       @tab Option
2386 @item @code{DERF(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab gnu
2387 @end multitable
2388 @end table
2389
2390
2391
2392 @node ERFC
2393 @section @code{ERFC} --- Error function 
2394 @findex @code{ERFC} intrinsic
2395 @cindex error function
2396
2397 @table @asis
2398 @item @emph{Description}:
2399 @code{ERFC(X)} computes the complementary error function of @var{X}.
2400
2401 @item @emph{Option}:
2402 gnu
2403
2404 @item @emph{Class}:
2405 elemental function
2406
2407 @item @emph{Syntax}:
2408 @code{X = ERFC(X)}
2409
2410 @item @emph{Arguments}:
2411 @multitable @columnfractions .15 .80
2412 @item @var{X} @tab The type shall be @code{REAL(*)}, and it shall be scalar.
2413 @end multitable
2414
2415 @item @emph{Return value}:
2416 The return value is a scalar of type @code{REAL(*)} and it is positive
2417 (@math{ 0 \leq erfc (x) \leq 2 }.
2418
2419 @item @emph{Example}:
2420 @smallexample
2421 program test_erfc
2422   real(8) :: x = 0.17_8
2423   x = erfc(x)
2424 end program test_erfc
2425 @end smallexample
2426
2427 @item @emph{Specific names}:
2428 @multitable @columnfractions .24 .24 .24 .24
2429 @item Name            @tab Argument          @tab Return type       @tab Option
2430 @item @code{DERFC(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab gnu
2431 @end multitable
2432 @end table
2433
2434
2435
2436 @node ETIME
2437 @section @code{ETIME} --- Execution time subroutine (or function)
2438 @findex @code{ETIME} intrinsic
2439 @cindex ETIME subroutine 
2440
2441 @table @asis
2442 @item @emph{Description}:
2443 @code{ETIME(TARRAY, RESULT)} returns the number of seconds of runtime
2444 since the start of the process's execution in @var{RESULT}.  @var{TARRAY}
2445 returns the user and system components of this time in @code{TARRAY(1)} and
2446 @code{TARRAY(2)} respectively. @var{RESULT} is equal to @code{TARRAY(1) + TARRAY(2)}.
2447
2448 On some systems, the underlying timings are represented using types with
2449 sufficiently small limits that overflows (wraparounds) are possible, such as
2450 32-bit types. Therefore, the values returned by this intrinsic might be, or
2451 become, negative, or numerically less than previous values, during a single
2452 run of the compiled program.
2453
2454 If @code{ETIME} is invoked as a function, it can not be invoked as a
2455 subroutine, and vice versa.
2456
2457 @var{TARRAY} and @var{RESULT} are @code{INTENT(OUT)} and provide the following:
2458
2459 @multitable @columnfractions .15 .30 .60
2460 @item @tab @code{TARRAY(1)}: @tab User time in seconds.
2461 @item @tab @code{TARRAY(2)}: @tab System time in seconds.
2462 @item @tab @code{RESULT}: @tab Run time since start in seconds.
2463 @end multitable
2464
2465 @item @emph{Option}:
2466 gnu
2467
2468 @item @emph{Class}:
2469 subroutine
2470
2471 @item @emph{Syntax}:
2472 @multitable @columnfractions .8
2473 @item @code{CALL ETIME(TARRAY, RESULT)}.
2474 @item @code{RESULT = ETIME(TARRAY)}, (not recommended).
2475 @end multitable
2476
2477 @item @emph{Arguments}:
2478 @multitable @columnfractions .15 .80
2479 @item @var{TARRAY}@tab The type shall be @code{REAL, DIMENSION(2)}.
2480 @item @var{RESULT}@tab The type shall be @code{REAL}.
2481 @end multitable
2482
2483 @item @emph{Return value}:
2484 Elapsed time in seconds since the start of program execution.
2485
2486 @item @emph{Example}:
2487 @smallexample
2488 program test_etime
2489     integer(8) :: i, j
2490     real, dimension(2) :: tarray
2491     real :: result
2492     call ETIME(tarray, result)
2493     print *, result
2494     print *, tarray(1)
2495     print *, tarray(2)   
2496     do i=1,100000000    ! Just a delay
2497         j = i * i - i
2498     end do
2499     call ETIME(tarray, result)
2500     print *, result
2501     print *, tarray(1)
2502     print *, tarray(2)
2503 end program test_etime
2504 @end smallexample
2505 @end table
2506
2507
2508
2509 @node EXIT
2510 @section @code{EXIT} --- Exit the program with status. 
2511 @findex @code{EXIT}
2512 @cindex exit
2513
2514 @table @asis
2515 @item @emph{Description}:
2516 @code{EXIT} causes immediate termination of the program with status.  If status
2517 is omitted it returns the canonical @emph{success} for the system.  All Fortran
2518 I/O units are closed. 
2519
2520 @item @emph{Option}:
2521 gnu
2522
2523 @item @emph{Class}:
2524 non-elemental subroutine
2525
2526 @item @emph{Syntax}:
2527 @code{CALL EXIT([STATUS])}
2528
2529 @item @emph{Arguments}:
2530 @multitable @columnfractions .15 .80
2531 @item @var{STATUS} @tab The type of the argument shall be @code{INTEGER(*)}.
2532 @end multitable
2533
2534 @item @emph{Return value}:
2535 @code{STATUS} is passed to the parent process on exit.
2536
2537 @item @emph{Example}:
2538 @smallexample
2539 program test_exit
2540   integer :: STATUS = 0
2541   print *, 'This program is going to exit.'
2542   call EXIT(STATUS)
2543 end program test_exit
2544 @end smallexample
2545 @end table
2546
2547
2548
2549 @node EXP
2550 @section @code{EXP} --- Exponential function 
2551 @findex @code{EXP} intrinsic
2552 @findex @code{DEXP} intrinsic
2553 @findex @code{ZEXP} intrinsic
2554 @findex @code{CDEXP} intrinsic
2555 @cindex exponential
2556
2557 @table @asis
2558 @item @emph{Description}:
2559 @code{EXP(X)} computes the base @math{e} exponential of @var{X}.
2560
2561 @item @emph{Option}:
2562 f95, gnu
2563
2564 @item @emph{Class}:
2565 elemental function
2566
2567 @item @emph{Syntax}:
2568 @code{X = EXP(X)}
2569
2570 @item @emph{Arguments}:
2571 @multitable @columnfractions .15 .80
2572 @item @var{X} @tab The type shall be @code{REAL(*)} or
2573 @code{COMPLEX(*)}.
2574 @end multitable
2575
2576 @item @emph{Return value}:
2577 The return value has same type and kind as @var{X}.
2578
2579 @item @emph{Example}:
2580 @smallexample
2581 program test_exp
2582   real :: x = 1.0
2583   x = exp(x)
2584 end program test_exp
2585 @end smallexample
2586
2587 @item @emph{Specific names}:
2588 @multitable @columnfractions .24 .24 .24 .24
2589 @item Name            @tab Argument          @tab Return type       @tab Option
2590 @item @code{DEXP(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
2591 @item @code{CEXP(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
2592 @item @code{ZEXP(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2593 @item @code{CDEXP(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2594 @end multitable
2595 @end table
2596
2597
2598
2599 @node EXPONENT
2600 @section @code{EXPONENT} --- Exponent function 
2601 @findex @code{EXPONENT} intrinsic
2602 @cindex exponent function
2603
2604 @table @asis
2605 @item @emph{Description}:
2606 @code{EXPONENT(X)} returns the value of the exponent part of @var{X}. If @var{X}
2607 is zero the value returned is zero. 
2608
2609 @item @emph{Option}:
2610 f95, gnu
2611
2612 @item @emph{Class}:
2613 elemental function
2614
2615 @item @emph{Syntax}:
2616 @code{I = EXPONENT(X)}
2617
2618 @item @emph{Arguments}:
2619 @multitable @columnfractions .15 .80
2620 @item @var{X} @tab The type shall be @code{REAL(*)}.
2621 @end multitable
2622
2623 @item @emph{Return value}:
2624 The return value is of type default @code{INTEGER}.
2625
2626 @item @emph{Example}:
2627 @smallexample
2628 program test_exponent
2629   real :: x = 1.0
2630   integer :: i
2631   i = exponent(x)
2632   print *, i
2633   print *, exponent(0.0)
2634 end program test_exponent
2635 @end smallexample
2636 @end table
2637
2638
2639
2640 @node FLOOR
2641 @section @code{FLOOR} --- Integer floor function
2642 @findex @code{FLOOR} intrinsic
2643 @cindex floor
2644
2645 @table @asis
2646 @item @emph{Description}:
2647 @code{FLOOR(X)} returns the greatest integer less than or equal to @var{X}.
2648
2649 @item @emph{Option}:
2650 f95, gnu
2651
2652 @item @emph{Class}:
2653 elemental function
2654
2655 @item @emph{Syntax}:
2656 @code{I = FLOOR(X[,KIND])}
2657
2658 @item @emph{Arguments}:
2659 @multitable @columnfractions .15 .80
2660 @item @var{X} @tab The type shall be @code{REAL(*)}.
2661 @item @var{KIND} @tab Optional scaler integer initialization expression.
2662 @end multitable
2663
2664 @item @emph{Return value}:
2665 The return value is of type @code{INTEGER(KIND)}
2666
2667 @item @emph{Example}:
2668 @smallexample
2669 program test_floor
2670     real :: x = 63.29
2671     real :: y = -63.59
2672     print *, floor(x) ! returns 63
2673     print *, floor(y) ! returns -64
2674 end program test_floor
2675 @end smallexample
2676 @end table
2677
2678
2679
2680 @node FNUM
2681 @section @code{FNUM} --- File number function
2682 @findex @code{FNUM} intrinsic
2683 @cindex fnum
2684
2685 @table @asis
2686 @item @emph{Description}:
2687 @code{FNUM(UNIT)} returns the Posix file descriptor number corresponding to the
2688 open Fortran I/O unit @code{UNIT}.
2689
2690 @item @emph{Option}:
2691 gnu
2692
2693 @item @emph{Class}:
2694 non-elemental function
2695
2696 @item @emph{Syntax}:
2697 @code{I = FNUM(UNIT)}
2698
2699 @item @emph{Arguments}:
2700 @multitable @columnfractions .15 .80
2701 @item @var{UNIT} @tab The type shall be @code{INTEGER}.
2702 @end multitable
2703
2704 @item @emph{Return value}:
2705 The return value is of type @code{INTEGER}
2706
2707 @item @emph{Example}:
2708 @smallexample
2709 program test_fnum
2710   integer :: i
2711   open (unit=10, status = "scratch")
2712   i = fnum(10)
2713   print *, i
2714   close (10)
2715 end program test_fnum
2716 @end smallexample
2717 @end table
2718
2719
2720
2721 @node LOG
2722 @section @code{LOG} --- Logarithm function
2723 @findex @code{LOG} intrinsic
2724 @findex @code{ALOG} intrinsic
2725 @findex @code{DLOG} intrinsic
2726 @findex @code{CLOG} intrinsic
2727 @findex @code{ZLOG} intrinsic
2728 @findex @code{CDLOG} intrinsic
2729 @cindex logarithm
2730
2731 @table @asis
2732 @item @emph{Description}:
2733 @code{LOG(X)} computes the logarithm of @var{X}.
2734
2735 @item @emph{Option}:
2736 f95, gnu
2737
2738 @item @emph{Class}:
2739 elemental function
2740
2741 @item @emph{Syntax}:
2742 @code{X = LOG(X)}
2743
2744 @item @emph{Arguments}:
2745 @multitable @columnfractions .15 .80
2746 @item @var{X} @tab The type shall be @code{REAL(*)} or
2747 @code{COMPLEX(*)}.
2748 @end multitable
2749
2750 @item @emph{Return value}:
2751 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2752 The kind type parameter is the same as @var{X}.
2753
2754 @item @emph{Example}:
2755 @smallexample
2756 program test_log
2757   real(8) :: x = 1.0_8
2758   complex :: z = (1.0, 2.0)
2759   x = log(x)
2760   z = log(z)
2761 end program test_log
2762 @end smallexample
2763
2764 @item @emph{Specific names}:
2765 @multitable @columnfractions .24 .24 .24 .24
2766 @item Name            @tab Argument          @tab Return type       @tab Option
2767 @item @code{ALOG(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab f95, gnu
2768 @item @code{DLOG(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
2769 @item @code{CLOG(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
2770 @item @code{ZLOG(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2771 @item @code{CDLOG(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2772 @end multitable
2773 @end table
2774
2775
2776
2777 @node LOG10
2778 @section @code{LOG10} --- Base 10 logarithm function
2779 @findex @code{LOG10} intrinsic
2780 @findex @code{ALOG10} intrinsic
2781 @findex @code{DLOG10} intrinsic
2782 @cindex logarithm
2783
2784 @table @asis
2785 @item @emph{Description}:
2786 @code{LOG10(X)} computes the base 10 logarithm of @var{X}.
2787
2788 @item @emph{Option}:
2789 f95, gnu
2790
2791 @item @emph{Class}:
2792 elemental function
2793
2794 @item @emph{Syntax}:
2795 @code{X = LOG10(X)}
2796
2797 @item @emph{Arguments}:
2798 @multitable @columnfractions .15 .80
2799 @item @var{X} @tab The type shall be @code{REAL(*)} or
2800 @code{COMPLEX(*)}.
2801 @end multitable
2802
2803 @item @emph{Return value}:
2804 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2805 The kind type parameter is the same as @var{X}.
2806
2807 @item @emph{Example}:
2808 @smallexample
2809 program test_log10
2810   real(8) :: x = 10.0_8
2811   x = log10(x)
2812 end program test_log10
2813 @end smallexample
2814
2815 @item @emph{Specific names}:
2816 @multitable @columnfractions .24 .24 .24 .24
2817 @item Name            @tab Argument          @tab Return type       @tab Option
2818 @item @code{ALOG10(X)}  @tab @code{REAL(4) X}  @tab @code{REAL(4)}    @tab f95, gnu
2819 @item @code{DLOG10(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
2820 @end multitable
2821 @end table
2822
2823
2824
2825 @node SIN
2826 @section @code{SIN} --- Sine function 
2827 @findex @code{SIN} intrinsic
2828 @findex @code{DSIN} intrinsic
2829 @findex @code{ZSIN} intrinsic
2830 @findex @code{CDSIN} intrinsic
2831 @cindex sine
2832
2833 @table @asis
2834 @item @emph{Description}:
2835 @code{SIN(X)} computes the sine of @var{X}.
2836
2837 @item @emph{Option}:
2838 f95, gnu
2839
2840 @item @emph{Class}:
2841 elemental function
2842
2843 @item @emph{Syntax}:
2844 @code{X = SIN(X)}
2845
2846 @item @emph{Arguments}:
2847 @multitable @columnfractions .15 .80
2848 @item @var{X} @tab The type shall be @code{REAL(*)} or
2849 @code{COMPLEX(*)}.
2850 @end multitable
2851
2852 @item @emph{Return value}:
2853 The return value has same type and king than @var{X}.
2854
2855 @item @emph{Example}:
2856 @smallexample
2857 program test_sin
2858   real :: x = 0.0
2859   x = sin(x)
2860 end program test_sin
2861 @end smallexample
2862
2863 @item @emph{Specific names}:
2864 @multitable @columnfractions .24 .24 .24 .24
2865 @item Name            @tab Argument          @tab Return type       @tab Option
2866 @item @code{DSIN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
2867 @item @code{CSIN(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
2868 @item @code{ZSIN(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2869 @item @code{CDSIN(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2870 @end multitable
2871 @end table
2872
2873
2874
2875 @node SINH
2876 @section @code{SINH} --- Hyperbolic sine function 
2877 @findex @code{SINH} intrinsic
2878 @findex @code{DSINH} intrinsic
2879 @cindex hyperbolic sine
2880
2881 @table @asis
2882 @item @emph{Description}:
2883 @code{SINH(X)} computes the hyperbolic sine of @var{X}.
2884
2885 @item @emph{Option}:
2886 f95, gnu
2887
2888 @item @emph{Class}:
2889 elemental function
2890
2891 @item @emph{Syntax}:
2892 @code{X = SINH(X)}
2893
2894 @item @emph{Arguments}:
2895 @multitable @columnfractions .15 .80
2896 @item @var{X} @tab The type shall be @code{REAL(*)}.
2897 @end multitable
2898
2899 @item @emph{Return value}:
2900 The return value is of type @code{REAL(*)}.
2901
2902 @item @emph{Example}:
2903 @smallexample
2904 program test_sinh
2905   real(8) :: x = - 1.0_8
2906   x = sinh(x)
2907 end program test_sinh
2908 @end smallexample
2909
2910 @item @emph{Specific names}:
2911 @multitable @columnfractions .24 .24 .24 .24
2912 @item Name            @tab Argument          @tab Return type       @tab Option
2913 @item @code{DSINH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
2914 @end multitable
2915 @end table
2916
2917
2918
2919 @node SQRT
2920 @section @code{SQRT} --- Square-root function
2921 @findex @code{SQRT} intrinsic
2922 @findex @code{DSQRT} intrinsic
2923 @findex @code{CSQRT} intrinsic
2924 @findex @code{ZSQRT} intrinsic
2925 @findex @code{CDSQRT} intrinsic
2926 @cindex square-root
2927
2928 @table @asis
2929 @item @emph{Description}:
2930 @code{SQRT(X)} computes the square root of @var{X}.
2931
2932 @item @emph{Option}:
2933 f95, gnu
2934
2935 @item @emph{Class}:
2936 elemental function
2937
2938 @item @emph{Syntax}:
2939 @code{X = SQRT(X)}
2940
2941 @item @emph{Arguments}:
2942 @multitable @columnfractions .15 .80
2943 @item @var{X} @tab The type shall be @code{REAL(*)} or
2944 @code{COMPLEX(*)}.
2945 @end multitable
2946
2947 @item @emph{Return value}:
2948 The return value is of type @code{REAL(*)} or @code{COMPLEX(*)}.
2949 The kind type parameter is the same as @var{X}.
2950
2951 @item @emph{Example}:
2952 @smallexample
2953 program test_sqrt
2954   real(8) :: x = 2.0_8
2955   complex :: z = (1.0, 2.0)
2956   x = sqrt(x)
2957   z = sqrt(z)
2958 end program test_sqrt
2959 @end smallexample
2960
2961 @item @emph{Specific names}:
2962 @multitable @columnfractions .24 .24 .24 .24
2963 @item Name            @tab Argument          @tab Return type       @tab Option
2964 @item @code{DSQRT(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
2965 @item @code{CSQRT(X)}  @tab @code{COMPLEX(4) X}  @tab @code{COMPLEX(4)}    @tab f95, gnu
2966 @item @code{ZSQRT(X)}  @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2967 @item @code{CDSQRT(X)} @tab @code{COMPLEX(8) X}  @tab @code{COMPLEX(8)}    @tab f95, gnu
2968 @end multitable
2969 @end table
2970
2971
2972
2973 @node TAN
2974 @section @code{TAN} --- Tangent function
2975 @findex @code{TAN} intrinsic
2976 @findex @code{DTAN} intrinsic
2977 @cindex tangent
2978
2979 @table @asis
2980 @item @emph{Description}:
2981 @code{TAN(X)} computes the tangent of @var{X}.
2982
2983 @item @emph{Option}:
2984 f95, gnu
2985
2986 @item @emph{Class}:
2987 elemental function
2988
2989 @item @emph{Syntax}:
2990 @code{X = TAN(X)}
2991
2992 @item @emph{Arguments}:
2993 @multitable @columnfractions .15 .80
2994 @item @var{X} @tab The type shall be @code{REAL(*)}.
2995 @end multitable
2996
2997 @item @emph{Return value}:
2998 The return value is of type @code{REAL(*)}.  The kind type parameter is
2999 the same as @var{X}.
3000
3001 @item @emph{Example}:
3002 @smallexample
3003 program test_tan
3004   real(8) :: x = 0.165_8
3005   x = tan(x)
3006 end program test_tan
3007 @end smallexample
3008
3009 @item @emph{Specific names}:
3010 @multitable @columnfractions .24 .24 .24 .24
3011 @item Name            @tab Argument          @tab Return type       @tab Option
3012 @item @code{DTAN(X)}  @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
3013 @end multitable
3014 @end table
3015
3016
3017
3018 @node TANH
3019 @section @code{TANH} --- Hyperbolic tangent function 
3020 @findex @code{TANH} intrinsic
3021 @findex @code{DTANH} intrinsic
3022 @cindex hyperbolic tangent
3023
3024 @table @asis
3025 @item @emph{Description}:
3026 @code{TANH(X)} computes the hyperbolic tangent of @var{X}.
3027
3028 @item @emph{Option}:
3029 f95, gnu
3030
3031 @item @emph{Class}:
3032 elemental function
3033
3034 @item @emph{Syntax}:
3035 @code{X = TANH(X)}
3036
3037 @item @emph{Arguments}:
3038 @multitable @columnfractions .15 .80
3039 @item @var{X} @tab The type shall be @code{REAL(*)}.
3040 @end multitable
3041
3042 @item @emph{Return value}:
3043 The return value is of type @code{REAL(*)} and lies in the range
3044 @math{ - 1 \leq tanh(x) \leq 1 }.
3045
3046 @item @emph{Example}:
3047 @smallexample
3048 program test_tanh
3049   real(8) :: x = 2.1_8
3050   x = tanh(x)
3051 end program test_tanh
3052 @end smallexample
3053
3054 @item @emph{Specific names}:
3055 @multitable @columnfractions .24 .24 .24 .24
3056 @item Name            @tab Argument          @tab Return type       @tab Option
3057 @item @code{DTANH(X)} @tab @code{REAL(8) X}  @tab @code{REAL(8)}    @tab f95, gnu
3058 @end multitable
3059 @end table
3060
3061
3062
3063 @comment sub   flush
3064 @comment 
3065 @comment gen   fraction
3066 @comment 
3067 @comment gen   fstat
3068 @comment sub   fstat
3069 @comment 
3070 @comment sub   getarg
3071 @comment 
3072 @comment gen   getcwd
3073 @comment sub   getcwd
3074 @comment 
3075 @comment sub   getenv
3076 @comment 
3077 @comment gen   getgid
3078 @comment 
3079 @comment gen   getpid
3080 @comment 
3081 @comment gen   getuid
3082 @comment 
3083 @comment sub   get_command
3084 @comment 
3085 @comment sub   get_command_argument
3086 @comment 
3087 @comment sub   get_environment_variable
3088 @comment 
3089 @comment gen   huge
3090 @comment 
3091 @comment gen   iachar
3092 @comment 
3093 @comment gen   iand
3094 @comment 
3095 @comment gen   iargc
3096 @comment 
3097 @comment gen   ibclr
3098 @comment 
3099 @comment gen   ibits
3100 @comment 
3101 @comment gen   ibset
3102 @comment 
3103 @comment gen   ichar
3104 @comment 
3105 @comment gen   ieor
3106 @comment 
3107 @comment gen   index
3108 @comment 
3109 @comment gen   int
3110 @comment       ifix
3111 @comment       idint
3112 @comment 
3113 @comment gen   ior
3114 @comment 
3115 @comment gen   irand
3116 @comment 
3117 @comment gen   ishft
3118 @comment 
3119 @comment gen   ishftc
3120 @comment 
3121 @comment gen   kind
3122 @comment 
3123 @comment gen   lbound
3124 @comment 
3125 @comment gen   len
3126 @comment 
3127 @comment gen   len_trim
3128 @comment 
3129 @comment gen   lge
3130 @comment 
3131 @comment gen   lgt
3132 @comment 
3133 @comment gen   lle
3134 @comment 
3135 @comment gen   llt
3136 @comment 
3137 @comment gen   logical
3138 @comment 
3139 @comment gen   matmul
3140 @comment 
3141 @comment gen   max
3142 @comment       max0
3143 @comment       amax0
3144 @comment       amax1
3145 @comment       max1
3146 @comment       dmax1
3147 @comment 
3148 @comment gen   maxexponent
3149 @comment 
3150 @comment gen   maxloc
3151 @comment 
3152 @comment gen   maxval
3153 @comment 
3154 @comment gen   merge
3155 @comment 
3156 @comment gen   min
3157 @comment       min0
3158 @comment       amin0
3159 @comment       amin1
3160 @comment       min1
3161 @comment       dmin1
3162 @comment 
3163 @comment gen   minexponent
3164 @comment 
3165 @comment gen   minloc
3166 @comment 
3167 @comment gen   minval
3168 @comment 
3169 @comment gen   mod
3170 @comment       amod
3171 @comment       dmod
3172 @comment 
3173 @comment gen   modulo
3174 @comment 
3175 @comment sub   mvbits
3176 @comment 
3177 @comment gen   nearest
3178 @comment 
3179 @comment gen   nint
3180 @comment       idnint
3181 @comment 
3182 @comment gen   not
3183 @comment 
3184 @comment gen   null
3185 @comment 
3186 @comment gen   pack
3187 @comment 
3188 @comment gen   precision
3189 @comment 
3190 @comment gen   present
3191 @comment 
3192 @comment gen   product
3193 @comment 
3194 @comment gen   radix
3195 @comment 
3196 @comment gen   rand
3197 @comment       ran 
3198 @comment 
3199 @comment sub   random_number
3200 @comment 
3201 @comment sub   random_seed
3202 @comment 
3203 @comment gen   range
3204 @comment 
3205 @comment gen   real
3206 @comment       float
3207 @comment       sngl
3208 @comment 
3209 @comment gen   repeat
3210 @comment 
3211 @comment gen   reshape
3212 @comment 
3213 @comment gen   rrspacing
3214 @comment 
3215 @comment gen   scale
3216 @comment 
3217 @comment gen   scan
3218 @comment 
3219 @comment gen   second
3220 @comment sub   second
3221 @comment 
3222 @comment gen   selected_int_kind
3223 @comment 
3224 @comment gen   selected_real_kind
3225 @comment 
3226 @comment gen   set_exponent
3227 @comment 
3228 @comment gen   shape
3229 @comment 
3230 @comment gen   sign
3231 @comment       isign
3232 @comment       dsign
3233 @comment 
3234 @comment gen   size
3235 @comment 
3236 @comment gen   spacing
3237 @comment 
3238 @comment gen   spread
3239 @comment 
3240 @comment sub   srand
3241 @comment 
3242 @comment gen   stat
3243 @comment sub   stat
3244 @comment 
3245 @comment gen   sum
3246 @comment 
3247 @comment gen   system
3248 @comment sub   system
3249 @comment 
3250 @comment sub system_clock
3251 @comment 
3252 @comment gen   tiny
3253 @comment 
3254 @comment gen   transfer
3255 @comment 
3256 @comment gen   transpose
3257 @comment 
3258 @comment gen   trim
3259 @comment 
3260 @comment gen   ubound
3261 @comment 
3262 @comment gen   umask
3263 @comment sub   umask
3264 @comment 
3265 @comment gen   unlink
3266 @comment sub   unlink
3267 @comment 
3268 @comment gen   unpack
3269 @comment 
3270 @comment gen   verify
3271