jeff@aiai.ed.ac.uk (Jeff Dalton) (08/29/90)
In May 13 1988 draft (sorry, it's the only one I have), X3J11/88-90, it says: A strictly conforming program ... shall not produce output dependent on any unspecified, undefined, or implementation- defined behavior. [Section 1.7, page 4] Since the representations of floating types are unspecified, what, if any, output of fp numbers is allowed in strictly conforming programs? There's a more general question (or more then one) lurking in here somewhere, but I'm not sure how to state it (them) precisely. -- JD
gwyn@smoke.BRL.MIL (Doug Gwyn) (08/30/90)
In article <3295@skye.ed.ac.uk> jeff@aiai.UUCP (Jeff Dalton) writes: > A strictly conforming program ... shall not produce output > dependent on any unspecified, undefined, or implementation- > defined behavior. [Section 1.7, page 4] What you need to understand is that this is not intended as a constraint on output, but rather as a constraint on using nonstandard behavior in any "essential" way. For example, since the order of evaluation of the arguments to a function is unspecified, a strictly conforming program may have its flow of computation affected by the order, only so long as the "result" of doing so is the same no matter which order the implementation chooses. Note that this is not as strict as a requirement to not use nonstandard behavior at all. The actual constraint is phrased in terms of "output" because that's the closest we could come to saying "observable effects" in an enforceable way. Certainly it was not meant to forbid any use of formatted output of folating-point quantities.
lewine@dg-rtp.dg.com (Donald Lewine) (08/31/90)
In article <3295@skye.ed.ac.uk>, jeff@aiai.ed.ac.uk (Jeff Dalton) writes: |> In May 13 1988 draft (sorry, it's the only one I have), X3J11/88-90, |> it says: |> |> A strictly conforming program ... shall not produce output |> dependent on any unspecified, undefined, or implementation- |> defined behavior. [Section 1.7, page 4] |> |> Since the representations of floating types are unspecified, |> what, if any, output of fp numbers is allowed in strictly |> conforming programs? Section 4.9.6.1 describes the fprintf() conversions for %f, %e, %E, %g and %G. They produce well defined output. NOTE: It is possible to have a strictly conforming application which produces machine specific, non-portable output. If your program writes an array of double out with fwrite() and reads it back with fread(), the program may be conforming and portable even though the data is machine specific. This file is not an "output" of the program. -------------------------------------------------------------------- Donald A. Lewine (508) 870-9008 Voice Data General Corporation (508) 366-0750 FAX 4400 Computer Drive. MS D112A Westboro, MA 01580 U.S.A. uucp: uunet!dg!lewine Internet: lewine@cheshirecat.webo.dg.com