comp.lang.ada
 help / color / mirror / Atom feed
From: sercely@convex.com (Ron Sercely)
Subject: I/O question
Date: 29 Mar 93 21:34:38 GMT
Date: 1993-03-29T21:34:38+00:00	[thread overview]
Message-ID: <1993Mar29.213438.25890@convex.com> (raw)

Could someone tell me what is supposed to happen with this code?

with TEXT_IO;
use  TEXT_IO;
procedure PR30787 is
   type X_TYPE is digits 15;
   package MY_IO is new FLOAT_IO(X_TYPE);
   use  MY_IO;
   X : X_TYPE := (-5000001.84);
begin
   PUT(X, 1, 15, 2);
   NEW_LINE;
end PR30787;

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.  

What is "correct".



             reply	other threads:[~1993-03-29 21:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-03-29 21:34 Ron Sercely [this message]
1993-03-29 23:20 ` I/O question Mark A Biggar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox