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: 103376,f93adbf272b6f27 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!feeder.xsnews.nl!feeder.news-service.com!proxad.net!freenix!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Sender: obry@PASCAL Newsgroups: comp.lang.ada Subject: Re: how to safely convert from 32 to 16 bits? References: <6acda821.0506040923.1790561c@posting.google.com> From: Pascal Obry Date: 04 Jun 2005 19:53:09 +0200 Message-ID: Organization: Home - http://www.obry.net User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Date: 04 Jun 2005 19:53:13 CEST NNTP-Posting-Host: 82.120.144.194 X-Trace: 1117907593 news.wanadoo.fr 881 82.120.144.194:1729 X-Complaints-To: abuse@wanadoo.fr Xref: g2news1.google.com comp.lang.ada:11239 Date: 2005-06-04T19:53:13+02:00 List-Id: di98mase@hotmail.com (Sebastian) writes: > I have a variable of Integer_32 size, I also know that the value is > always between -180 and 180. I would like to assign that value to a 16 > bits Real type. > > How can that be done without loosing any data? I don't see the problem. A : Integer_32; B : Integer_16: B := Integer_16 (A); Since A is always between -180 and 180 there will be no exception raised. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595