From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1eaf7620b06b3c3f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1993-03-29 15:34:19 PST Newsgroups: comp.lang.ada Path: sparky!uunet!caen!nigel.msen.com!sdd.hp.com!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!ames!sgi!wdl1!wdl39!mab From: mab@wdl39.wdl.loral.com (Mark A Biggar) Subject: Re: I/O question Message-ID: <1993Mar29.232051.27575@wdl.loral.com> Sender: news@wdl.loral.com Organization: Loral Western Development Labs References: <1993Mar29.213438.25890@convex.com> Date: Mon, 29 Mar 1993 23:20:51 GMT Date: 1993-03-29T23:20:51+00:00 List-Id: In article <1993Mar29.213438.25890@convex.com> sercely@convex.com (Ron Sercely) writes: > type X_TYPE is digits 15; > package MY_IO is new FLOAT_IO(X_TYPE); > X : X_TYPE := (-5000001.84); >begin > PUT(X, 1, 15, 2); >On Convex Ada, the PUT raises LAYOUT_ERROR. This seems reasonable given that >the RM specifically states that the '-' sign counts as a character, and then >the '5' digit that should be output to the left of the decimal point means that >"-5" will not fit in a "fore" of 1. On the other hand, although the RM >(14.3.5(10) states: > "The exception LAYOUT_ERROR is raised by a PUT procedure that outputs >to a parameter of type STRING, if the length of the actual string is >insufficient for the output of the item". >I can't find where the RM states that LAYOUT_ERROR should be raised when the >length of a portion of formatted output will not fit into a field of the >output, and of course, strictly speaking, this is not output to a parameter >of type string. >Dec Ada on the other hand prints out the value -5.00000184 without raising an >exception. The Dec compiler appears to be correct. The last sentence of RM(14.3.5(7)) says: "The format given a PUT procedure is overridden if it is insufficiently wide." Which I interpret to mean, go back to the default if a field is not wide enough. But, I guess it could mean other things as well. For example, ti could be interpreted to mean override the whole format specification, or is could mean override just the parts that are undersized. In any case, it appears to be a bug to raise LAYOUT_ERROR in your example. -- Mark Biggar mab@wdl1.wdl.loral.com