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 Path: g2news2.google.com!postnews.google.com!g20g2000vba.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Conversion from floating point to signed 16 bits Date: Wed, 20 May 2009 05:06:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4a12ffa3$0$2853$ba620e4c@news.skynet.be> <4a13e54a$0$32672$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1242821192 24190 127.0.0.1 (20 May 2009 12:06:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 20 May 2009 12:06:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g20g2000vba.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5956 Date: 2009-05-20T05:06:31-07:00 List-Id: On May 20, 12:11=A0pm, Georg Bauhaus wrote: > Olivier Scalbert schrieb: > > > Hello, > > > My problem: > > I need to convert an "analogic" value which can vary from 0.0 to 1.0 > > into a "discrete" value which is a signed 16 bits integer. > > > My implementation: > > ----------------------------- > > with Ada.Text_IO; > > > procedure convert is > > =A0 =A0 type Analog_Value is digits 10 range 0.0 .. 1.0; > > =A0 =A0 type Signed_16 =A0 =A0is range -32768 .. 32767; > > =A0 =A0 type Unsigned_16 =A0is range =A0 =A0 =A00 .. 65535; > > It might be an idea to use a different name > for Unsigned_16 because this name is also > declared in standard package Interfaces. > Or use qualification. Avoids misunderstandings. Or better - just use package Interfaces instead... Cheers -- Martin