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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b257fba0affa289 X-Google-Attributes: gid103376,public From: Preben Randhol Subject: Re: fixed type (delta) in ada Date: 1999/11/29 Message-ID: #1/1 X-Deja-AN: 554346776 References: <383f6dbb.22609744@news.tstonramp.com> <81pvi5$sl1$1@nnrp1.deja.com> <38409C87.69EC865@easystreet.com> <87n1rzdm4u.fsf@deneb.cygnus.argh.org> <3841B57A.42C70EC0@easystreet.com> <38423E3B.BDE09DFF@easystreet.com> X-Complaints-To: usenet@itea.ntnu.no X-Trace: kopp.stud.ntnu.no 943866940 21417 129.241.83.82 (29 Nov 1999 09:15:40 GMT) Organization: ProgramVareVerkstedet NNTP-Posting-Date: 29 Nov 1999 09:15:40 GMT Newsgroups: comp.lang.ada Date: 1999-11-29T09:15:40+00:00 List-Id: Al Christians 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