From: Peter Seibel
Subject: Can someone explain the logic of FORMAT's ~G directive?
Date: 
Message-ID: <m3zn15bjvb.fsf@javamonkey.com>
In particular I'm confused by why the exponent is translated into
padding on the right? Why would anyone want that particular
formatting?

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp

From: Tim Bradshaw
Subject: Re: Can someone explain the logic of FORMAT's ~G directive?
Date: 
Message-ID: <1101474800.224646.118240@f14g2000cwb.googlegroups.com>
Peter Seibel wrote:
> In particular I'm confused by why the exponent is translated into
> padding on the right? Why would anyone want that particular
> formatting?

I think the answer is `FORTRAN': it's compatible with what FORTRAN
does.

--tim
  In fact, the answer to most questions is `FORTRAN'.
From: Tim Flynn
Subject: Re: Can someone explain the logic of FORMAT's ~G directive?
Date: 
Message-ID: <b1Cpd.23557$AL5.3197@twister.nyroc.rr.com>
Peter Seibel wrote:

> In particular I'm confused by why the exponent is translated into
> padding on the right? Why would anyone want that particular
> formatting?
> 
> -Peter
> 

  Suppose you're printing a table of values using the ~G format.  Some
values may be printed in fixed width format while others are printed in
exponential format.  By adding a number of padding characters to the fixed
width values equal to the number of characters used to print the exponent,
the field width is maintained and the values will be aligned (more or
less).

  You can try this to see what I mean :

 (dotimes (i 10) 
 (let ((x (* 3.1415 (expt 10 (- i 5)))))
  (format t "~8,2,2G ~8,2,2G~&" x (* 5 x))))

  Incidentally I suspect that this convention was defined for compatibility
with Fortran's G formatting :

 http://www.fortran.com/F77_std/rjcnf-13.html#sh-13.5.9.2.3

Tim
From: Peter Seibel
Subject: Re: Can someone explain the logic of FORMAT's ~G directive?
Date: 
Message-ID: <m3r7mgbl9r.fsf@javamonkey.com>
Tim Flynn <·······@stny.rr.com> writes:

> Incidentally I suspect that this convention was defined for
> compatibility with Fortran's G formatting :
>
>  http://www.fortran.com/F77_std/rjcnf-13.html#sh-13.5.9.2.3

Yup. There's a note to that effect in CLTL2 which I discovered after I
posted my original question. Thanks.

-Peter

-- 
Peter Seibel                                      ·····@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp