TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Thomas Seeling
from: Mike Bilow
date: 1997-01-25 11:14:22
subject: Floating point feature with optimization

Thomas Seeling wrote in a message to All:

 TS> ============================================================
 TS> * Forwarded von Thomas Seeling (2:244/1130.42)
 TS> * Area : emx
 TS> ============================================================
 TS> From: Holger Veit 


> I discovered that if you use the inline function optimization, trig
> functions break with large argument values. Try sin(1e30) -- the result
> isn't between -1 and 1!

 TS> Ever heard about the polynomial algorithms that implement
 TS> trigonometric functions? They are not made for such large
 TS> arguments. The 486 data sheet (and I have no doubts the
 TS> Pentium/PPro data sheets as well) talks about clock
 TS> penalties if an argument is larger than PI/4, a clear sign
 TS> that it has to rescale the operand first if it is outside
 TS> the guaranteed accuracy range of the used Taylor polynome. A
 TS> double precision variable has about 14-15 significant
 TS> digits, with 1e30 you are 15 powers of 10 away. 

The fact that the argument must be scaled is no indication one way or
another whether the particular method used is based on a Taylor polynomial.
 In fact, Intel FPUs do trig by table lookup and linear interpolation, and
it makes no difference whether the table is itself generated by a Taylor
polynomial or some other method from the point of view of run-time
operation.  One important reason for using table lookup is that relatively
consistent accuracy can be maintained across the domain of each trig
function simply by varying the density of points in the table as needed.

While we're on this subject, it should also be understood that computers do
not compute infinite polynomials efficiently -- Taylor or otherwise -- if
programmed to emulate the traditional term-by-term process which would be
performed by hand. Instead, efficient polynomial evaluation on a computer
depends upon choosing the number of terms which will be considered at the
outset, and then reducing the resulting finite polynomial.
 
-- Mike


--- 
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 50/99 54/99 270/101 620/243 625/110 160 711/401 413 430 808 934
SEEN-BY: 712/311 407 505 506 517 623 624 704 713/317 800/1
@PATH: 323/107 396/1 270/101 712/624 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.