OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [fortran/] [intrinsic.texi] - Blame information for rev 12

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.