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: a07f3367d7,6a8952cbe009f3ed X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.181.13.205 with SMTP id fa13mr1016274wid.3.1359079642798; Thu, 24 Jan 2013 18:07:22 -0800 (PST) MIME-Version: 1.0 Path: i11ni18211wiw.0!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.130.MISMATCH!xlned.com!feeder1.xlned.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.bawue.net!storethat.news.telefonica.de!telefonica.de!news-2.dfn.de!news.dfn.de!feeder.erje.net!eu.feeder.erje.net!newsfeed.x-privat.org!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Numerical calculations: Why not use fixed point types for everything? Date: Fri, 18 Jan 2013 15:39:03 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <4905b963-0036-4129-8050-fb26ef0154d6@googlegroups.com> <32314026-23ae-45b8-a4c5-e589e7d79de2@googlegroups.com> <7aeff757-a038-45e0-93d6-bd1d6e02093e@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1358545146 11774 69.95.181.76 (18 Jan 2013 21:39:06 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 18 Jan 2013 21:39:06 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-01-18T15:39:03-06:00 List-Id: "Adam Beneschan" wrote in message news:7aeff757-a038-45e0-93d6-bd1d6e02093e@googlegroups.com... ... >What I mean is that some processors (including the Pentium) have >instructions >to perform mathematical operations like trig functions, square-root, etc., >on >floating-point numbers, and special hardware to do the computation. We're talking Ada here, and in at least some cases (i.e. Intel processors), at least, those instructions aren't accurate enough to meet the requirements of Annex G for those mathematical operations. So it's unlikely that your compiler would use them (unless of course Annex G isn't supported at all, in which case you have no idea what the math actually does). So I find this to be a red herring: most Ada software uses only software trig functions and the like. The real problem is that Ada doesn't provide any fixed point mathematical functions, so you either have to roll-your-own (with all of the dangers of inaccurate results) or just convert to float (with the extra cost involved). But of course if you never use any of those functions (which would describe 98% of my code; the only one I use with any regularity is Sqrt, to calculate standard deviations), then fixed point is likely to be cheaper. Randy.