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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6fabd104d18f3943 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!e18g2000vbe.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: conversions between fixed-point types Date: Sun, 27 Sep 2009 12:22:38 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 82.30.110.254 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1254079359 6575 127.0.0.1 (27 Sep 2009 19:22:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 27 Sep 2009 19:22:39 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e18g2000vbe.googlegroups.com; posting-host=82.30.110.254; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8501 Date: 2009-09-27T12:22:38-07:00 List-Id: On Sep 20, 7:55=A0pm, Dirk Herrmann wrote: > As I said when I started this thread, I am currently investigating whethe= r Ada > could be a good replacement for the proprietary fixed-point oriented lang= uage > used in our company. =A0And, convincing my colleagues would certainly not= be > easier with statements like "Ada can be used, but you have to implement a= ll > fixed-point stuff yourself". =A0Even more if you can not even rely on the= fact > that a compiler will behave the same way throughout. Is the target hardware standard? (eg, PPC without floating-point support) If not, you're looking at a compiler port as well. Even though GNAT/x86 seems to truncate on predefined operations and on conversion from static values (though not, as far as I can tell, on dynamic conversion between two types!), there seems no intrinsic reason why a port to different hardware might not be made to round. > Robert A Duff wrote: > > By the way, you can say: > > > =A0 =A0 for T'Small use T'Delta; > > > to avoid repeating yourself. > > I have tried that, especially since the very same recommendation was give= n in > the Barnes book "Ada 2005". =A0But, GNAT gives an error message. =A0It se= ems that > the very moment you reference T'Delta the type T gets "frozen" such that = =A0the > "use" statement itself freezes T before it can modify it. =A0I don't know= if > this is what the authors of the reference manual had intended, but GNAT > interprets it that way. The idiom used to the T_Delta : constant :=3D 0.4; type T is delta T_Delta range -10.0 .. 10.0; for T'Small use T_Delta;