]> gcc.gnu.org Git - gcc.git/blame - gcc/fortran/doc/gfortran/intrinsic-procedures/aint.rst
docs: fix: WARNING: Parsing of expression failed. Using fallback parser.
[gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / aint.rst
CommitLineData
c63539ff
ML
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.. _aint:
7
8.. index:: AINT
9
10.. index:: DINT
11
12.. index:: floor
13
14.. index:: rounding, floor
15
16AINT --- Truncate to a whole number
17***********************************
18
a305ac87 19.. function:: AINT(A, KIND)
c63539ff
ML
20
21 ``AINT(A [, KIND])`` truncates its argument to a whole number.
22
23 :param A:
24 The type of the argument shall be ``REAL``.
25
26 :param KIND:
27 (Optional) An ``INTEGER`` initialization
28 expression indicating the kind parameter of the result.
29
30 :return:
31 The return value is of type ``REAL`` with the kind type parameter of the
32 argument if the optional :samp:`{KIND}` is absent; otherwise, the kind
33 type parameter will be given by :samp:`{KIND}`. If the magnitude of
34 :samp:`{X}` is less than one, ``AINT(X)`` returns zero. If the
35 magnitude is equal to or greater than one then it returns the largest
36 whole number that does not exceed its magnitude. The sign is the same
37 as the sign of :samp:`{X}`.
38
39 Standard:
40 Fortran 77 and later
41
42 Class:
43 Elemental function
44
45 Syntax:
46 .. code-block:: fortran
47
48 RESULT = AINT(A [, KIND])
49
50 Example:
51 .. code-block:: fortran
52
53 program test_aint
54 real(4) x4
55 real(8) x8
56 x4 = 1.234E0_4
57 x8 = 4.321_8
58 print *, aint(x4), dint(x8)
59 x8 = aint(x4,8)
60 end program test_aint
61
62 Specific names:
63 .. list-table::
64 :header-rows: 1
65
66 * - Name
67 - Argument
68 - Return type
69 - Standard
70
71 * - ``AINT(A)``
72 - ``REAL(4) A``
73 - ``REAL(4)``
74 - Fortran 77 and later
75 * - ``DINT(A)``
76 - ``REAL(8) A``
77 - ``REAL(8)``
a305ac87 78 - Fortran 77 and later
This page took 0.042052 seconds and 5 git commands to generate.