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!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.adelphia.com!news.adelphia.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 04 Jun 2005 13:41:01 -0500 From: "Robert Klungle" Newsgroups: comp.lang.ada References: <6acda821.0506040923.1790561c@posting.google.com> Subject: Re: how to safely convert from 32 to 16 bits? Date: Sat, 4 Jun 2005 11:45:45 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 Message-ID: <5JednXDeC-wgaDzfRVn-hQ@adelphia.com> NNTP-Posting-Host: 68.68.62.75 X-Trace: sv3-Cg3lh6TNmWj3KMNBpNzC3y6j7kjjFpP1AYVi+W8ygDehYRmbFjq0urlSCVf0J4dt0ERiEJlZfnmLkoi!zLhgNM62PaltyY9Y3GE+0BlnOXszmeGT3MWtVftTMtPSJXTt2scY70lpVvRSuUplg9Mx8sJTnbmK!4QyBBigprNExjQ== X-Complaints-To: abuse@adelphia.net X-DMCA-Complaints-To: copyright@adelphia.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:11240 Date: 2005-06-04T11:45:45-07:00 List-Id: Unless I misread the requestor, I think the following would more direct: A : Integer_32; B : Real_16; B := Real_16(A); cheers...bob "Pascal Obry" wrote in message news:uk6la101m.fsf@obry.net... > > 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