On Wed, 25 Nov 2020, Tobias Burnus 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

 Umm, my bad: 1.0 is Fortran single while 1d0 is a double literal.  So the 
raw values produced are correct for the VAX F-floating format, and for the 
D-floating I get:

        .align 2
        .type   h.2, @object
        .size   h.2, 8
h.2:
        .long   -32769
        .long   -1
        .align 2
        .type   e.1, @object
        .size   e.1, 8
e.1:
        .long   9472
        .long   0

which look right to me too.  Mind that VAX FP data are encoded in 16-bit
(word in DEC-speak) rather than 32-bit (longword in DEC-speak) chunks in 
memory.

 The options you mention (thanks for the hint) report:

  static real(kind=4) e = 1.1920928955078125e-7;
  static real(kind=4) h = 1.7014117331926442990585209174225846272e+38;

and:

  static real(kind=8) e = 2.77555756156289135105907917022705078125e-17;
  static real(kind=8) h = 1.7014118346046922937050406228106149888e+38;

respectively and reflect the 8-bit exponent.  For the G-floating format, 
produced with the `-mg' GCC option (a multilib candidate I would guess):

  static real(kind=8) e = 2.220446049250313080847263336181640625e-16;
  static real(kind=8) h = 
8.98846567431157854072637118658521783990352837629224982994e+307;

> 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

 Yeah, I've seen it my Fortran reference (not an official standard though; 
I don't remember where to get them from and given I don't seem to have a 
copy, I suspect they are charged for).

  Maciej

Reply via email to