Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: "James Van Buskirk" <torsop@ix.netcom.com>
Subject: Re: gcc vs Dec Unix c
Date: 1998/01/14	[thread overview]
Message-ID: <69jqsk$t7k@dfw-ixnews7.ix.netcom.com> (raw)
In-Reply-To: EMs7CB.K5r@bit3.com



brianh@bit3.com wrote in message ...
>In article <69hce6$8je@sjx-ixn6.ix.netcom.com>,
>James Van Buskirk <torsop@ix.netcom.com> wrote:
>>
>
>>FCOS instruction is k*2**n, where k & n are integers and
>>|k| < 2**53.
>
>Stupid question: can't all IEEE floating point numbers be treated as
>being in this form?  Or, actually, with a little modification- if
>the floating point number is m * 2**e, where 1 <= m < 2, and e is a
>small integer, then couldn't you set k = m * 2**p and n = e-p, where
>p is the precision of the floating point number (53 in the case of IEEE
>doubles)?
>
>Or am I missing something obvious?


Yes, all IEEE 754 double precision floating point numbers are in this
form, but the point that I was trying to make (with the word 'ideal')
was that not all numbers are of this form.  Thus when your program
calls for cos(x), the number x cannot be represented, in general,
with perfect accuracy as an IEEE 754 double precision floating
point number.  For example, when your program calculates
cos(1234567890.d0), the number you really want the cosine of could
be anywhere from 1234567890-2^(-23) to 1234567890+2^(-23).  In an
ordinary program one should not, in my opinion, be dismayed if the
cosine of any number in this range is returned.  In fact Intel uses
an internal 66-bit value of pi when it reduces to the range of
validity for its minmax polynomial, so the range goes down to
1234567890-2^(-36) to 1234567890+2^(-36), and the value returned
e.g. by LF90 corresponds to an input in that range.  Digital's
alpha compilers (e.g. DVF90 Pro) seem to interpret the input as
exact and produce the double precision cosine of the 'exact' input
to double precision accuracy (confirmed by comparing 100 digit
Mathematica output.)  In many contexts, the extra accuracy is
illusory as the input in the above case would have to be known to 30
bits more accuracy for the last bit of the output to have any
meaning.  Curiously, DVF90 Pro gets the same results with both
the 'fast' and the 'accurate' math libraries, although the 'accurate'
library takes about twice as long to get there.  In cases where the
IEEE 754 representation of the input is exact, Digital is doing
much better than Intel here but I think that those cases are
relatively rare.





  reply	other threads:[~1998-01-14  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 ` 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               ` James Van Buskirk
1998-01-14  5:00                 ` brianh
1998-01-14  5:00                   ` James Van Buskirk [this message]
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             ` gcc vs Dec Unix c 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-13  5:00             ` Rob Komar
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       ` cekim
1998-01-14  5:00       ` Rob Komar
1998-01-16  5:00         ` Torbjorn Lindgren
1998-01-17  5:00           ` Rob Komar
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