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!gegeweb.org!news.redatomik.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed1-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> 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:01:44 GMT Message-ID: <55be7728$0$3323$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 02 Aug 2015 22:01:44 CEST NNTP-Posting-Host: 94.71.68.35 X-Trace: 1438545704 news-4.free.fr 3323 94.71.68.35:57226 X-Complaints-To: abuse@proxad.net Xref: news.eternal-september.org comp.lang.ada:27335 Date: 2015-08-02T22:01:44+02:00 List-Id: 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. > - Bob