From: "James Van Buskirk" <torsop@ix.netcom.com>
Subject: Re: gcc vs Dec Unix c
Date: 1998/01/13 [thread overview]
Message-ID: <69hce6$8je@sjx-ixn6.ix.netcom.com> (raw)
In-Reply-To: y6oh1ge5w2.fsf@tweedledumb.cygnus.com
Craig Burley wrote in message ...
>As should be clear by now, thanks to Robert Harley's post, not
>only was I right, but the reality is that the reason you see
>faster Pentium performance is that you don't mind getting wrong
>answers.
The Pentium answers look wrong only if the ideal input to the
FCOS instruction is k*2**n, where k & n are integers and
|k| < 2**53. The alpha answers could be generated possibly by
an algorithm that normalizes the (unbiased) exponent to 0 (or
perhaps less) if it is initially greater than this, calculates
the cosine of the resulting normalized number, then uses angle
doubling (cos(2**(n+1)*theta) = 2*cos(2**n*theta)-1) to make up
for the exponent modification in the first step. As R. Harley
points out, such an approach can give you accurate results for
numbers of the form k*2**n, but you pay big time for this
'accuracy' even when your input isn't of this form. Perhaps
the C standard requires this, though...
It seems like it wouldn't be a bad idea to switch to an approach
that reduced the input modulo pi when the exponent gets big
enough; if the user required exact results for numbers of the
form k*2**n, she could use trig identities in her program
instead of burdening the rest of the library users with her
otherwise unwarranted overhead. Of course if the input is > 2**53,
in absolute value a reasonable output would be a NaN.
next prev parent reply other threads:[~1998-01-13 5:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-01-08 5:00 gcc vs Dec Unix c fonte
1998-01-09 5:00 ` Toon Moene
1998-01-09 5:00 ` Jaap Schellekens
1998-01-09 5:00 ` cekim
1998-01-09 5:00 ` Peter Mardahl
1998-01-09 5:00 ` Craig Burley
1998-01-10 5:00 ` cekim
1998-01-10 5:00 ` Craig Burley
1998-01-13 5:00 ` cekim
1998-01-13 5:00 ` Craig Burley
1998-01-13 5:00 ` [++] x86 FCOS (Was: Re: gcc vs Dec Unix c) Terje Mathisen
1998-01-13 5:00 ` Andy Glew
1998-01-14 5:00 ` Terje Mathisen
1998-01-13 5:00 ` James Van Buskirk [this message]
1998-01-14 5:00 ` gcc vs Dec Unix c brianh
1998-01-14 5:00 ` James Van Buskirk
1998-01-13 5:00 ` Rob Komar
1998-01-13 5:00 ` Yan-Song Chen
1998-01-13 5:00 ` Greg Lindahl
1998-01-15 5:00 ` Lupo LeBoucher
1998-01-15 5:00 ` Greg Lindahl
1998-01-14 5:00 ` bmeyer
1998-01-15 5:00 ` cekim
1998-01-14 5:00 ` Donald K.Sinclair
1998-01-14 5:00 ` Rob Komar
1998-01-16 5:00 ` Torbjorn Lindgren
1998-01-17 5:00 ` Rob Komar
1998-01-14 5:00 ` cekim
1998-01-09 5:00 ` Toon Moene
1998-01-09 5:00 ` Toon Moene
-- strict thread matches above, loose matches on Subject: below --
1998-01-13 5:00 Robert Harley
1998-01-14 5:00 ` cekim
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox