[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Format



    Date: Mon, 18 May 87 15:46:42 PDT
    From: Richard Berman <berman@vaxa.isi.edu>


    What should this do:

    (FORMAT () "~E" 3/4)

    I have one implementation that produces "0.75" and another that produces
    "7.5E-1".  As far as I can detect, the latter MAY be correct.  CLtL says, on
    page 393 about the ~E directive, "If all of [the parameters] are omitted, then
    the effect is to print the value using ordinary free-format
    exponential-notation output; prin1 uses this format for any non-zero number
    whose magnitude is less than 10^-3 or greater than or equal to 10^7.
	 "If arg is a rational number, then it is coerced to be a single-float and
    then printed."

	    It is unclear whether: (a) the same format used by prin1 for numbers
    in the given range should be used regardless of the range of the arg, or (b)
    if it should print like prin1.

To me, that sentence strictly says that PRIN1 may contain code like the
following:
	(when (and (not (= number 0.0))
		   (or (< number 1.0e-3)
		       (>= number 1.0e7)))
	  (format stream "~E" number))

which I guess corresponds to your (a).

Whether that is what was intended is a different story....
						barmar