]>
Commit | Line | Data |
---|---|---|
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 | .. index:: DIGITS, model representation, significant digits | |
7 | ||
8 | .. _digits: | |
9 | ||
10 | DIGITS --- Significant binary digits function | |
11 | ********************************************* | |
12 | ||
13 | .. function:: DIGITS(X) | |
14 | ||
15 | ``DIGITS(X)`` returns the number of significant binary digits of the internal | |
16 | model representation of :samp:`{X}`. For example, on a system using a 32-bit | |
17 | floating point representation, a default real number would likely return 24. | |
18 | ||
19 | :param X: | |
20 | The type may be ``INTEGER`` or ``REAL``. | |
21 | ||
22 | :return: | |
23 | The return value is of type ``INTEGER``. | |
24 | ||
25 | Standard: | |
26 | Fortran 90 and later | |
27 | ||
28 | Class: | |
29 | Inquiry function | |
30 | ||
31 | Syntax: | |
32 | .. code-block:: fortran | |
33 | ||
34 | RESULT = DIGITS(X) | |
35 | ||
36 | Example: | |
37 | .. code-block:: fortran | |
38 | ||
39 | program test_digits | |
40 | integer :: i = 12345 | |
41 | real :: x = 3.143 | |
42 | real(8) :: y = 2.33 | |
43 | print *, digits(i) | |
44 | print *, digits(x) | |
45 | print *, digits(y) | |
3ed1b4ce | 46 | end program test_digits |