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,c6acbb9f2027b8c9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!colt.net!peernews3.colt.net!newsfeed.stueberl.de!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: volatile vs aliased Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.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: <1128525722.605730.281980@g43g2000cwa.googlegroups.com> <87mzlnomca.fsf@ludovic-brenta.org> <1421562.dbAHjS9XJS@linux1.krischik.com> Date: Thu, 6 Oct 2005 10:52:59 +0200 Message-ID: NNTP-Posting-Date: 06 Oct 2005 10:52:59 MEST NNTP-Posting-Host: c1c5b081.newsread2.arcor-online.net X-Trace: DXC=D8@RGiV On Thu, 06 Oct 2005 10:05:38 +0200, Martin Krischik wrote: > Ludovic Brenta wrote: > >> pragma Volatile (Variable) says the compiler must not optimise away >> any reads or writes to that variable, and that it may not add extra >> reads or writes beyond those you explicitly request in your program >> text. You want to use that for hardware registers, where a "read" >> operation may have a side effect such as changing the device's state. > > Interesting! So with pragma Volatile (X) the following two statements are > not the same: > > Y := X * X; > Y := X ** 2; > > Good to know! BTW, even without Volatile, they are not necessary same! For intervals X*X /= X**2! Example: [-1, 2] * [-1, 2] = [-1, 4] [-1, 2]**2 = [2, 4] X**2 is as twice as more accurate than X*X. To improve accuracy of * and /, arguments need to be analyzed for dependency. X + X = 2 * X, no matter what. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de