[gfortran] I/O of large integer and real kinds

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Jun 7 19:47:00 GMT 2005


On Mon, Jun 06, 2005 at 11:34:09PM +0200, FX Coudert wrote:
> Index: libgfortran/io/write.c
> @@ -321,11 +338,28 @@ output_float (fnode *f, double value)
>      edigits = 2;
>    else
>      {
> +#if defined (HAVE_GFC_REAL_10) || defined (HAVE_GFC_REAL_16)
> +# if HAVE_LOG10L || HAVE_LOG10L_IN_LIBSUNMATH
> +      abslog = fabs(log10l (value));

fabsl

> +# else
> +      extern long double __log10l (long double);
> +      abslog = fabs(__log10l (value));

fabsl

> -  sprintf (buffer, "%+-#31.*e", ndigits - 1, value);
> +  /* #   The result will always contain a decimal point, even if no
> +   *     digits follow it
> +   *
> +   * -   The converted value is to be left adjusted on the field boundary
> +   *
> +   * +   A sign (+ or -) always be placed before a number
> +   *
> +   * 31  minimum field width
> +   *
> +   * *   (ndigits-1) is used as the precision
> +   *
> +   *   e format: [-]d.ddde??dd where there is one digit before the
> +   *   decimal-point character and the number of digits after it is
> +   *   equal to the precision. The exponent always contains at least two
> +   *   digits; if the value is zero, the exponent is 00.
> +   */
> +  sprintf (buffer, "%+-#31.*" GFC_REAL_LARGEST_FORMAT "e",
> +           ndigits - 1, value);

In the case of long double, do we need to "Le" instead of "e"?

>      {
> +#if (HAVE_GFC_REAL_10 || HAVE_GFC_REAL_16) && HAVE_FINITEL
> +      res = finitel (n);
> +#else
>        res = isfinite (n);
> +#endif
>        if (res == 0)

Shouldn't this be someting like

#if (HAVE_GFC_REAL_10 || HAVE_GFC_REAL_16)
# if HAVE_FINITEL
    res = finitel (n);
# else
    res = gfc_finitel (n);  /* a builtin or we supply in c99_functions.c */
# endif
#else

> -  uint64_t n = 0;
> +//FXC  uint32_t ns =0;

Delete or #if 0/#endif the code.

> +//FXC  if (len < 8)
> +//     {
> +//       ns = n;
> +//       q = conv (ns);
> +//     }
> +//  else

Delete or #if 0/#endif the code.

-- 
Steve



More information about the Fortran mailing list