comp.lang.ada
 help / color / mirror / Atom feed
From: Al Christians <achrist@easystreet.com>
Subject: Re: fixed type (delta) in ada
Date: 1999/11/28
Date: 1999-11-28T00:00:00+00:00	[thread overview]
Message-ID: <3841B57A.42C70EC0@easystreet.com> (raw)
In-Reply-To: 87n1rzdm4u.fsf@deneb.cygnus.argh.org

Ok. I see that there are two values in the perfect result 
set.  No problem.  I see that in the ARM.  But it would be 
nice if the compiler would pick out the result that is more 
perfect, ie closer to the actual value.  I see that this 
stuff is also leftover from Ada 83, retained to make it 
possible to preserve behavior of existing programs.  But 
since the choice of values out of the possible result set 
is  implementation dependent, that looks more like more 
like a broad license than a precise spec.  'This is what 
is expected' doesn't explain it as well as 'this is one 
result that is allowed'.  Thanks.

Next question: I haven't seen where it says that

Money_Io.Put(0.20 * 351.0);

Should put 68.55, which is what GNAT 3.12p does.  My guess 
would be that 0.20 * 351.0 should be a static expression of 
type universal real, which should convert to type Money 
equal to 70.2 within +/- 0.01.  Is it according to the LRM 
to convert both the 0.20 and 351.0 to the Money type before 
doing the multiply?  Any other explanations?


Al



Florian Weimer wrote:
> 
> Al Christians <achrist@easystreet.com> writes:
> 
> > > No, the output should be 71.3, and this is what is expected.
> >
> > So, why does GNAT 3.12p give 68.55?
> 
> That's correct as well. 0.20 can be represented as 25/128 or 26/128
> (ARM 4.6(32), G.2.3(10), G.2.3(24)).




  reply	other threads:[~1999-11-28  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-27  0:00 fixed type (delta) in ada Nap
1999-11-26  0:00 ` Al Christians
1999-11-27  0:00   ` fixed type (delta) in ada and GNAT bug David C. Hoos, Sr.
1999-11-28  0:00 ` fixed type (delta) in ada Nick Roberts
1999-11-30  0:00   ` Simon Wright
1999-11-28  0:00 ` Robert Dewar
1999-11-27  0:00   ` Al Christians
1999-11-28  0:00     ` Florian Weimer
1999-11-28  0:00       ` Al Christians [this message]
1999-11-29  0:00         ` Preben Randhol
1999-11-29  0:00           ` Al Christians
1999-11-29  0:00             ` Preben Randhol
1999-11-28  0:00     ` Preben Randhol
1999-11-29  0:00     ` Robert Dewar
1999-11-29  0:00       ` Al Christians
1999-11-29  0:00         ` Lutz Donnerhacke
1999-11-29  0:00           ` Preben Randhol
replies disabled

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