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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,acba876b1e3c9639 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: GNAT Optimization of Constant Expressions Date: Fri, 18 May 2007 12:28:04 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1179355028.624745.258370@q75g2000hsh.googlegroups.com> <464cb4cd$1_3@news.bluewin.ch> <1179442153.169828.109970@l77g2000hsb.googlegroups.com> <1179487665.6721.7.camel@localhost.localdomain> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1179509163 11461 69.95.181.76 (18 May 2007 17:26:02 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 18 May 2007 17:26:03 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Xref: g2news1.google.com comp.lang.ada:15836 Date: 2007-05-18T12:28:04-05:00 List-Id: "Georg Bauhaus" wrote in message news:1179487665.6721.7.camel@localhost.localdomain... > On Thu, 2007-05-17 at 18:38 -0500, Randy Brukardt wrote: > > > Ada has fairly strict requirements on accuracy that C and > > Fortran don't have. An optimizer shouldn't be providing the *wrong* answer > > in order to make code fast; > > An Apple employee once recommended using the then new FPT > optimizations and to see whether the optimized program will meet > the expectations. ("You can always sell speed".) So maybe accurate > computation is a far reaching requirement for some software > markets. I think it is generally agreed these days that the Ada accuracy requirements were a mistake, because they put Ada at a competitive disadvantage compared to other languages for floating point math. Indeed, that is why they were moved into "strict mode" in Ada 95. The problem is, faced with the need to implement strict mode anyway, implementers have tended to avoid implementing relaxed modes, because extra modes simply doubles the implementation and testing effort - the fewer modes the better. And the argument is "who wants less accuracy anyway?". We talked briefly about dropping the accuracy requirements altogether this time, but its obvious that would screw anyone that was depending on them. And that didn't seem like a good idea. So Ada is rather stuck with its slower but predictably accurate math. (In practice, this really only matters in programs with intensive FP, like the OP's example.) Randy.