On 8/19/25 10:43 AM, Steve Kargl wrote:
Anyone have time to commit the following patch.


Correct documentation of FRACTION intrinsic subprogram

In transripting the Fortran standard language, the expression
in LaTeX $X \times b^{-e}$ was translated into Fortran code.
'b' is the base of the floating point representation and
returned by RADIX(X).  But, it returns an INTEGER value, so
RADIX(X)**(-EXPONENT(x)) is zero for any positive exponent.
Use REAL(RADIX(X)).



Hi Steve, I can do it this evening.

Jerry

diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index 3941914f622..1045cb33825 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -6814,7 +6814,6 @@ GNU extension
  @end table
-
  @node FRACTION
  @section @code{FRACTION} --- Fractional part of the model representation
  @fnindex FRACTION
@@ -6840,14 +6839,15 @@ Elemental function
  @item @emph{Return value}:
  The return value is of the same type and kind as the argument.
  The fractional part of the model representation of @code{X} is returned;
-it is @code{X * RADIX(X)**(-EXPONENT(X))}.
+it is @code{X * REAL(RADIX(X))**(-EXPONENT(X))}.
@item @emph{Example}:
  @smallexample
  program test_fraction
+  implicit none
    real :: x
    x = 178.1387e-4
-  print *, fraction(x), x * radix(x)**(-exponent(x))
+  print *, fraction(x), x * real(radix(x))**(-exponent(x))
  end program test_fraction
  @end smallexample



Reply via email to