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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6fabd104d18f3943 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!news.albasani.net!not-for-mail From: Dirk Herrmann Newsgroups: comp.lang.ada Subject: Re: conversions between fixed-point types Date: Mon, 28 Sep 2009 22:50:35 +0200 Organization: albasani.net Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net n1mM/I6naG8NnCChB0W8Sg03b4Q7jjc+JVpnkCHA8dsyjf6juD6QviFMrD2L8Q9VCfHnL/wWAD+XnVoZJQHsg6KlTErwtGMBUV+jwHjN2BXOWzd4QNe8yapIYD2pHfXh X-Complaints-To: abuse@albasani.net NNTP-Posting-Date: Mon, 28 Sep 2009 20:50:36 +0000 (UTC) X-User-ID: ULr96WvjOqPouq0JOehh2xXtMvghmt9mDNf1fp6H6yMIfhyfXSS/3vaMS0T5zk5Elx03I3jAMEQZfpn1D8eOZg== In-Reply-To: Cancel-Lock: sha1:sM8+8oE2OXeakvIpkVw+YQMn6p4= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) X-NNTP-Posting-Host: IrQD1oevKBKAOnRM/g//F/NK6opGci4Hy8KYdMiRR5M= Xref: g2news2.google.com comp.lang.ada:8522 Date: 2009-09-28T22:50:35+02:00 List-Id: Robert A Duff wrote: > Does it make sense in your context to avoid "odd-ball" smalls? > Note that the default 'Small is a power of 2. Actually, most of our code uses powers of two. Still we have to think about rounding when, for example, we are converting values from a small of 0.125 to a small of 0.5. But, Adam's suggestion seems to work fine: Y := Integer (X / FpB'Small) * FpB'Small; The resulting x86 assembly code could be improved a little, but I have not checked the ARM code yet. -- Dirk