OSDN Git Service

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