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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107079,183ebe04e93f0506 X-Google-Attributes: gid107079,public X-Google-Thread: 103376,183ebe04e93f0506 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: fixed point vs floating point Date: 1997/11/25 Message-ID: #1/1 X-Deja-AN: 292734966 Distribution: inet References: <65846t$4vq$1@gonzo.sun3.iaf.nl> <65c58j$1302@mean.stat.purdue.edu> Organization: Estormza Software Newsgroups: comp.lang.ada,sci.math.num-analysis Date: 1997-11-25T00:00:00+00:00 List-Id: In article , gwinn@res.ray.com (Joe Gwinn) wrote: >In one recent example, Square Root was taking 60 microseconds on a 50-MHz >68060; this should take no more than 2 uS. Where did the time go? To >range check after range check. To internal use of 96-bit extended floats >(which must be done in the 68060 FP instruction emulation library rather >than the CPU hardware), all to implement a 32-bit float function. To >functions within functions, all checking everything. Etc. Same kind of >story with the transcendental functions, only worse. One needs to read >the generated assembly code to know what a given compiler is up to. > >We only need a few functions, specifically Sine, Cosine, Arc Tangent, and >Square Root, speed is very much of the essence, and we need only 10e-4 to >10e-5 (16-bit) accuracy anyway. So, we will write our own versions of >these functions, in Ada, C, or even assembly, as determined by performance >tests. If you want to turn off constraint checking for intermediate values, be sure to use T'Base, ie O : My_Float'Base; That way only overflow checks (done in hardware) will occur. This will (I think) be a better comparison to another language, such as C, which doesn't perform any range checks. The selective use of T'Base gives the Ada 95 programmer control of when range checks occur. Thanks for the other info too, Matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271