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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!news.ecp.fr!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-b.proxad.net!nnrp4-1.free.fr!not-for-mail From: =?iso-8859-1?b?RnLpZOlyaWM=?= Praca Subject: Re: Representation clauses and side-efects on STM32F411 ravenscar runtime Newsgroups: comp.lang.ada References: <55bddbe2$0$3384$426a74cc@news.free.fr> <87io8xlb3p.fsf@theworld.com> <55be7728$0$3323$426a34cc@news.free.fr> <87egjlla7z.fsf@theworld.com> User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 02 Aug 2015 20:27:51 GMT Message-ID: <55be7d47$0$3323$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 02 Aug 2015 22:27:51 CEST NNTP-Posting-Host: 94.71.68.35 X-Trace: 1438547271 news-4.free.fr 3323 94.71.68.35:57226 X-Complaints-To: abuse@proxad.net Xref: news.eternal-september.org comp.lang.ada:27337 Date: 2015-08-02T22:27:51+02:00 List-Id: Le Sun, 02 Aug 2015 16:13:52 -0400, Bob Duff a écrit : > Frédéric Praca writes: > >> Le Sun, 02 Aug 2015 15:54:50 -0400, Bob Duff a écrit : >> >>> "Jeffrey R. Carter" writes: >>> >>>> On 08/02/2015 01:59 AM, Frédéric Praca wrote: >>>>> >>>>> type Mantissa is range 0 .. 2**12 - 1 with Size => 12; >>>>> type Fraction is range 0 .. 2**4 - 1 with Size => 4; >>> >>> Note that the Sizes will be 12 and 4 by default. >>> >>>> Wouldn't modular types be better for these? >>> >>> Why would you want wraparound arithmetic for these? Seems like it >>> would just hide bugs. >> >> I fully agree. Mantissa and Fraction don't have to use wraparound >> arithmetic. In fact, these two variables together represent a fixed >> point type and the magic must be inside the functions which calculates >> these variables according to the bus frequency and by the way must take >> care of the carry and possible overflow. > > Then would a fixed-point type work? > > type Baud_Rate is delta 1.0/16 range ...; > for Baud_Rate'Small use 1.0/16; Maybe. I have to try this but this is tightly coupled to my example and don't explain the side effects I also have on other records with representation clauses :) Anyway, it could be a better way to represent things I need to investigate. > - Bob Fred