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,184737148aef02ac X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Fixed point multiplication ambiguity Date: 1999/01/14 Message-ID: #1/1 X-Deja-AN: 432713506 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <369E14CA.90715966@lmco.com> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1999-01-14T00:00:00+00:00 List-Id: Marc A. Criley (marc.a.criley@lmco.com) wrote: : The following test program is compilable by Rational Apex, but : GNAT rejects it with: : tf.adb:5:38: type cannot be determined from context : tf.adb:5:38: explicit conversion to result type required : I've studied the LRM 4.5.5(13-20), but who has the correct : interpretation doesn't quite jump out at me, though I am : leaning towards one over the other. : -------------------- : procedure Tf is : D : Duration := 5.0; : Dec_Delt : Integer := Integer (D * 10.0 + 0.5); This is legal. Overload resolution interprets "D * 10.0" as returning universal_fixed. This is implicitly convertible to Duration (as well as any other fixed point type), as is 0.5. Presuming there is no other fixed-point type with a directly visible "+", this should resolve, and use the "+" of Duration. : begin : null; : end Tf; : ----------------------- : Marc A. Criley : Chief Software Architect : Lockheed Martin M&DS : (610) 354-7861 -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Distributed IT Solutions (www.averstar.com/tools) AverStar (formerly Intermetrics, Inc.) Burlington, MA USA