]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/transfer.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / transfer.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: TRANSFER, bits, move, type cast
7
8 .. _transfer:
9
10 TRANSFER --- Transfer bit patterns
11 **********************************
12
13 .. function:: TRANSFER(SOURCE, MOLD, SIZE)
14
15 Interprets the bitwise representation of :samp:`{SOURCE}` in memory as if it
16 is the representation of a variable or array of the same type and type
17 parameters as :samp:`{MOLD}`.
18
19 :param SOURCE:
20 Shall be a scalar or an array of any type.
21
22 :param MOLD:
23 Shall be a scalar or an array of any type.
24
25 :param SIZE:
26 (Optional) shall be a scalar of type
27 ``INTEGER``.
28
29 :return:
30 The result has the same type as :samp:`{MOLD}`, with the bit level
31 representation of :samp:`{SOURCE}`. If :samp:`{SIZE}` is present, the result is
32 a one-dimensional array of length :samp:`{SIZE}`. If :samp:`{SIZE}` is absent
33 but :samp:`{MOLD}` is an array (of any size or shape), the result is a one-
34 dimensional array of the minimum length needed to contain the entirety
35 of the bitwise representation of :samp:`{SOURCE}`. If :samp:`{SIZE}` is absent
36 and :samp:`{MOLD}` is a scalar, the result is a scalar.
37
38 Standard:
39 Fortran 90 and later
40
41 Class:
42 Transformational function
43
44 Syntax:
45 .. code-block:: fortran
46
47 RESULT = TRANSFER(SOURCE, MOLD[, SIZE])
48
49 Example:
50 .. code-block:: fortran
51
52 PROGRAM test_transfer
53 integer :: x = 2143289344
54 print *, transfer(x, 1.0) ! prints "NaN" on i686
55 END PROGRAM