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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx04.eternal-september.org!mx04.eternal-september.org!feeder.eternal-september.org!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 18 Jan 2013 12:14:58 -0600 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Numerical calculations: Why not use fixed point types for everything? Date: Fri, 18 Jan 2013 13:15:06 -0500 Organization: > Bestiaria Support Staff < Message-ID: <3l3jf85ae05qgsl2l0avomebmg2ogl17rq@invalid.netcom.com> References: <4905b963-0036-4129-8050-fb26ef0154d6@googlegroups.com> <32314026-23ae-45b8-a4c5-e589e7d79de2@googlegroups.com> X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.79.216.213 X-Trace: sv3-XUSCzlT2bFxmRqc4ACbJipM7RnkSd961et5tKpl7fYJYsK2XpaTeE//LLCpisDU/LfxP7BVMEUas8s0!syNPf9taN6meiBigO0OY+Ia/twZwfHsUxcmK1TZecXRXWr26ANz5DwVCXAvSIc/CeJAETWfmeHpk!569/pRHX2787aFuzaU5EV9QVrhWrPve8mV2e/4ETKK8= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2842 Xref: news.eternal-september.org comp.lang.ada:13920 Date: 2013-01-18T13:15:06-05:00 List-Id: On Fri, 18 Jan 2013 01:17:37 -0800 (PST), Ada novice declaimed the following in comp.lang.ada: > > I have read (John Mc Cormick: Building parallel...with Ada's book) that fixed point arithmetic is faster than floating-point arithmetic since integer instructions are faster so I would ask about the second point put by Adam that mathematical functions are slow with fixed-point numbers. Can you please elaborate on that? > Integer operations may be faster than floating point... But fixed point with a non-zero decimal place add in the overhead of having to track where the point is and shifting results to match the declared data type. 25 * 25 => 725 2.5 * 2.5 => 7.25 -- but if the data type is only one decimal place this now has to be rounded and shifted to become 7.3. All these adjustments and tracking are being done at the high-level instruction set, not in the processor hardware. In contrast, a floating point processor does all the mantissa and exponent adjustments in the hardware, which may be faster than having to do things like -- ld i1, 25 mult i1, 25 add i1, 5 div i1, 10 -- the sequence to treat integer registers as fixed 1-decimal place data compared to (the add/div would be added by the compiler based upon the number of decimal places to be kept in the result, based upon the number of places that were in the source ld f1, 2.5E0 mult f1, 2.5E0 -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/