On 25.11.20 23:02, Maciej W. Rozycki wrote:

Well, it does not link, for the somewhat unsurprising reason of a missing
libgfortran runtime.  I have modified the program with whatever little
Fortran skills I gained a while ago to get something that can be parseable
for a human being in the assembly form:

You could also try -fdump-tree-original or -fdump-parse-tree
which might be a bit more readable than assembler – at least
it avoids the problem of D-floating format.

   real(8) :: h = HUGE(1.0)
   real(8) :: e = EPSILON(1.0)

   print *,h
   print *,e
end

huge and epsilon are defined as:
  huge(x) = (1 - b**(-p)) * b**(emax-1) * b
  epsilon(x) = b**(1-p)
with
  b = radix = REAL_MODE_FORMAT (mode)->b
  p = digits = REAL_MODE_FORMAT (mode)->p
  emax = max_exponent = REAL_MODE_FORMAT (mode)->emax

For C/C++, it is defined with
  %s = FLT, DBL, LDBL + FLT%d%s with %d e.g. 128 and %s = "" or "X" if extended
as
  __%s_MAX__ = builtin_define_with_hex_fp_value (... decimal_dig ...)
with
  decimal_dig = 1 + fmt->p * log10_b
and
  __%s_EPSILON__
as
  if (fmt->pnan < fmt->p)
    /* This is an IBM extended double format, so 1.0 + any double is
       representable precisely.  */
      sprintf (buf, "0x1p%d", fmt->emin - fmt->p);
    else
      sprintf (buf, "0x1p%d", 1 - fmt->p);


Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter

Reply via email to