OSDN Git Service

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