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,fa37ee962bc4b00d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!wns13feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Conversion from floating point to signed 16 bits References: <4a12ffa3$0$2853$ba620e4c@news.skynet.be> <5d240393-452e-46d8-bc55-e46901bb1d6f@d19g2000prh.googlegroups.com> In-Reply-To: <5d240393-452e-46d8-bc55-e46901bb1d6f@d19g2000prh.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 173.16.158.68 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1242763036 173.16.158.68 (Tue, 19 May 2009 19:57:16 GMT) NNTP-Posting-Date: Tue, 19 May 2009 19:57:16 GMT Organization: AT&T ASP.att.net Date: Tue, 19 May 2009 19:57:16 GMT Xref: g2news2.google.com comp.lang.ada:5948 Date: 2009-05-19T19:57:16+00:00 List-Id: Adam Beneschan wrote: > > If your problem is that you're getting a Constraint_Error when the > subtraction "U16 - 32768" has a negative result, you can convert U16 > to some larger integer type before doing the subtraction: That wouldn't happen as written because the subtraction would use the base type, which is symmetrical (more or less) around zero. -- Jeff Carter "Pray that there's intelligent life somewhere up in space, 'cause there's bugger all down here on earth." Monty Python's Meaning of Life 61