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: "David C. Hoos, Sr." Subject: Re: Fixed point multiplication ambiguity Date: 1999/01/14 Message-ID: <77ldc7$f1a@hobbes.crc.com>#1/1 X-Deja-AN: 432634362 References: <369E14CA.90715966@lmco.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Coleman Research Corporation Newsgroups: comp.lang.ada Date: 1999-01-14T00:00:00+00:00 List-Id: Marc A. Criley wrote in message <369E14CA.90715966@lmco.com>... >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); > >begin > null; >end Tf; > The problem is simply that the compileter has to guess the type of "10.0", or have D converted to Float. Either of the following lines is acceptable to gnat. Dec_Delt : Integer := Integer (Float (D) * 10.0) + 0.5); Dec_Delt : Integer := Integer (D * Integer (10.0) + 0.5); David C. Hoos, Sr.