From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.0 required=3.0 tests=BAYES_20,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=c3=b6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Re: Fixed vs float and precision and conversions Date: Wed, 8 Jul 2020 21:41:32 +0200 Organization: A noiseless patient Spider Message-ID: References: <756885db-118a-4d76-b90d-e547a3cabf28o@googlegroups.com> <518ff68b-1017-4775-8248-c40048b4fe67o@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 8 Jul 2020 19:41:32 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="bbc4443e166da1163e3df9d7300a854c"; logging-data="27620"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2c78IuWtwsWHQymV56g6N" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 Cancel-Lock: sha1:5T4OYsLAV+z6V5oarVYq5saNTuQ= In-Reply-To: Content-Language: sv Xref: reader01.eternal-september.org comp.lang.ada:59403 List-Id: Den 2020-07-08 kl. 20:36, skrev Dmitry A. Kazakov: > On 08/07/2020 20:10, Björn Lundin wrote: >> Den 2020-07-08 kl. 20:08, skrev Björn Lundin: >> >> The main reason for asking was to see if I got the whole concept >> of fixed types wrong or not. > > Fixed-point is conceptually a scaled integer. You should deal with it > accordingly. [It could be a bit surprising in Ada where conversion to > integer rounds. In most languages conversion to integer truncates] > >> I did expect >> 'You should do this or that one-liner' as Niklas proposed. >> I did not get that to work though > > What do you mean it does not work? Of course T'Round works for > fixed-point types. Yes, of course *that* works. But unfortuantly, it does not solve my problem. As I replied to Niklas: It is at least not certain that the number expressed in fixed_type is one of them in the array below. And that is my real problem - I think. -- Björn