Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Joachim Wesner <joachim.wesner@frankfurt.netsurf.de>
Subject: Re: sin() on alpha.
Date: 1998/05/24	[thread overview]
Message-ID: <35674B96.4F02DB91@frankfurt.netsurf.de> (raw)
In-Reply-To: uf90ntn3ff.fsf@ghost2.snu.ac.kr


Dong-Woon Park wrote:
> 
> Thanks for replies.
>
> 
> Why polynomials are faster ? I don't know at all about the way
> co-processor or libm works. Doesn't libm use these schemes? or is
> there any chance to lose some accuracy using polynomials instead of
> sin() libm provides ?
> 

the actual libm uses polynomials, however

1) approximating over a certain range is only one part of the task,
   you need also do range reduction for larger arguments and this can
be    a nontrivial task for example for the trig-functions. It is *NOT*
   good enough to subtract a multiple of a double precision pi value
   to get into the range, this will give you a totally wrong result
   for say sin(1e6). Somebody would probably say, this is pointless,
   because the relative precision in the large argument is so
much          lower, however, the usual philosophy here is to take the
big number
   as "exact" and to demand that the routine should give the same result
   for that large number as an infinite precision calculation (within
   the few lowest bits). Usually that means you need to simulate kind
of    a quad floating precision calculation here.

2) the libm range reduction is pretty complex (way larger in sourcecode
   than any of the approximation routines therein), I think a bit
   overdone in precision and it seems that gcc does a bad job in
   compiling it.

3) Likewise the approximation polymials in libm are a bit to much on the
   save side regarding (theoretical) precision, that is mostly lost in
   the rest of the calculation, that is only double precision, for
   speed.

4) Still, my measurements clearly show that for large arguments, running 
   time in libm is mostly governed by range reduction and not
   approximation.

5) goto in japan rewrote part of the sine and cos routines in
assembler     and optimized the approximation with respect to the
pipelined nature
   of the alpha, however, it seems he still uses the c-Version of the
   too slow original range reduction, and looses again for large
   arguments.

I'm working on a different set of routines that uses a somewhat simpler
approximation that sacrifices some accuracy for speed and it seems I
have a more effective range reduction. However, in the recent days I
have been porting very interesting routines from Cray they use on their
Multiple-Alpha machine (somebody pointed those out here) that have
virtually constant running times for all arguments. The copyright status
of those is not yet totally clear, these could be pretty interesting for
us. See my other post.

Joachim



  parent reply	other threads:[~1998-05-24  4:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-22  4:00 sin() on alpha Dong-Woon Park
1998-05-22  4:00 ` Bruce Allen
1998-05-22  4:00   ` Greg Lindahl
1998-05-23  4:00   ` Dong-Woon Park
1998-05-23  4:00     ` Bruce Allen
1998-05-24  4:00       ` Joachim Wesner
1998-05-24  4:00     ` Joachim Wesner [this message]
1998-05-23  4:00   ` Christopher Browne
1998-05-23  4:00     ` Linus Torvalds
1998-05-23  4:00       ` Andi Kleen
1998-05-23  4:00       ` Greg Lindahl
1998-05-24  4:00         ` sin() on alpha / Cray libm Joachim Wesner
1998-05-23  4:00     ` sin() on alpha Michal Jaegermann
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