Re: math coprocessors
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: Re: math coprocessors
- From: gabriel at athens.ees.anl.gov (John Gabriel)
- Date: Tue, 23 Oct 90 11:00:02 CDT
I may be speaking from a position of ignorance here, because my knowledge is several years out of date, but the computation of y=sin(x) contains deep pitfalls even for values of x as small as small as 62.83. The point is that for x outside [0..pi/4), multiples of pi/4 must be subtracted from x. For x values close to n*(pi/4) this must be done with consummate skill if work is being done in double precision, or a good deal of significance will be lost. Cody & Waite (A Handbook for the Elementary Functions) discuss the issue at length. So computation of sin(x) for large arguments is always fraught with danger. For a given machine precision, there is typically a value of x beyond which computation of sin(x) will inevitably have significant error, and for some algorithms even x in the region of a few hundreds gives trouble (the worst I ever saw gave noticeable error round about x=30). More recent cases involving functions other than sin(x), investigated by a colleague in the context of FORTRAN exonerated an INTEL floating point co-processor, and laid the blame squarely on a compiler writer in one case, and perhaps on the operating system in another (I don't really know about the second case). So, I suppose the point of all this is that you should not necessarily blame the floating point chip. But perhaps Mathematica takes all the appropriate precautions about argument reduction and has the proper approximation to pi to allow the usual 2 step argument reduction to work OK. On the other hand, if pi is simply held to working precision (no matter how long that may be) argument reduction holds traps for the unwary. But I would be surprised if any IEEE standard chip gave good answers for 2^100. Good answers for 2^70 however, are not obviously ruled out except by a much more careful examination than I have given to the question. John Gabriel (gabriel at ees.anl.gov)