comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol@pvv.org>
Subject: Re: fixed type (delta) in ada
Date: 1999/11/29
Date: 1999-11-29T09:15:40+00:00	[thread overview]
Message-ID: <m3aenxwtde.fsf@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: 38423E3B.BDE09DFF@easystreet.com

Al Christians <achrist@easystreet.com> writes:

| I don't see anything in Barnes that matches my example very well.
| I'll guess that the compiler sees Money_Io.Put(351.00 * 0.20) and
| decides that it has to find a multiplication operator that yields
| a Money result to match the type of Money_Io.Put's parameter. The 
| only possibility is to multiply two Money's together, so the 
| 351.00 and 0.20 get converted automatically before the multiply,
| producing the 68.55 result. Money_Io.Put(Money(351.00 * 0.20)) will 
| give the more accurate 70.2 result. 


With my limited knowledge of Ada95 I would assume that as
Money_IO.Put() expects a type of Money the operator "*" is the
derivative function: 

function "*" (Left,Right : Money'Base) return Money'Base; 

(Not quite sure if 'Base is needed) And thus uses this. 
As is the latter example it uses:

function "*" (Left,Right : Float'Base) return Float'Base;

as Money will type cast it from Float to Money.

Is this correct? 

-- 
Preben Randhol -- [randhol@pvv.org] -- [http://www.pvv.org/~randhol/]     
"Det eneste trygge stedet i verden er inne i en fortelling." 
                                             -- Athol Fugard




  reply	other threads:[~1999-11-29  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
1999-11-29  0:00         ` Preben Randhol
1999-11-29  0:00           ` Al Christians
1999-11-29  0:00             ` Preben Randhol [this message]
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