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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,388fc53f584bd695 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!news-peer.in.tum.de!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Fixed point constants issue Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1f0l0baynq1x7$.phl9cqpwcr37.dlg@40tude.net> <1ak1k4eh1p96t$.essf9fu1cx4z$.dlg@40tude.net> <1nlhu18d10l2j$.1o2b3qlrc5rki$.dlg@40tude.net> Date: Wed, 15 Sep 2010 22:11:22 +0200 Message-ID: <1b49oqlzjju34.f1m9x8l8vjpd.dlg@40tude.net> NNTP-Posting-Date: 15 Sep 2010 22:11:21 CEST NNTP-Posting-Host: 595793e0.newsspool4.arcor-online.net X-Trace: DXC=o`X]U6KQkbI@k=MdN::NBI4IUK On Wed, 15 Sep 2010 19:24:23 +0200, Vinzent Hoefler wrote: > On Wed, 15 Sep 2010 10:35:22 +0200, Dmitry A. Kazakov > wrote: > >> On Tue, 14 Sep 2010 19:42:52 +0200, Vinzent Hoefler wrote: >> >>> -- 8< -- snip -- >>> type BASE_TYPE is delta 1.0 / 64.0 range 0.0 .. 1.0; >>> for BASE_TYPE'Small use 1.0 / 128.0; >> >> But use suggests rather: >> >> type Base_Type is delta 0.01 digits 3 range 0.0..1.0; >> >> or >> >> type Base_Type is delta 0.01 digits 3 range -1.0..1.0; > > No. These are bus-protocol types (read: hardware types) where MSB values, > bit sizes and (valid) range are given, so we definitely want to make sure that the > compile uses the correct representation. OK, I would never do it this way. In similar cases I use a modular or integer type. Which is converted to a floating point or fixed point type suitable for further computations or processing. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de