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=0.1 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,FREEMAIL_REPLY autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: How to round to the nearest fixed-point value? Date: Thu, 23 Jan 2014 07:02:59 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Thu, 23 Jan 2014 07:02:59 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="31d6bde745a337034b005384ef225743"; logging-data="29014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6DIgdWxJUlO5RyBq/pUzC" User-Agent: slrn/0.9.9p1 (FreeBSD) Cancel-Lock: sha1:xldf5tX8QlXExBIWH1V2SMWMJ6U= X-Original-Bytes: 1791 Xref: number.nntp.dca.giganews.com comp.lang.ada:184517 Date: 2014-01-23T07:02:59+00:00 List-Id: On 2014-01-22, adambeneschan@gmail.com wrote: > I'm pretty sure this is a compiler bug. Since Low'Small is a multiple of High'Small, you can work around it by changing the definition of Convert to > > return Low (Value + Low'Small / 2); > > (Low'Small is a universal real and therefore Low'Small/2 will be interpreted as a value of type High. The type conversion to Low will truncate.) I have been considering that, however it seems type conversion truncates towards zero, so the expression above is only correct for positive Values, while Low'Small/2 should be subtracted when Value is negative. Or am I missing something?