Request for Question Clarification by
mathtalk-ga
on
06 Jun 2004 14:34 PDT
Hi, shashko-ga:
A microprocessor itself, if it computes elementary transcendental
functions at all, does so over restricted ranges. A high-level
implementation (such as from within a C compiler, for example) takes
advantage of the low-level machine instructions by combining range
reduction operations with calls to those simplified microprocessor
instructions.
In the specific case of the sine and cosine functions, one might
implement only the restricted range [0,pi/4] for both, because other
argument ranges are quite easily "mapped" to this one. For example,
the sine and cosine functions are periodic (of period 2pi), so any
argument can be reduce to one in the range from -pi to +pi (for either
function). The sine function is odd and the cosine function even, so
in either case the functions' values on [-pi,0] are trivially related
to those on [0,+pi]. Further reduction to [0,pi] would be based on
the standard formulas for supplementary and complementary angles, e.g.
cos(pi - x) = - cos(x)
cos(pi/2 - x) = sin(x)
In the case of logarithmic functions the range reduction would be most
naturally carried out by "scaling" with powers of two (assuming a
binary arithmetic format) to restricted range [1,2]. For example:
ln(x * 2^n) = ln(x) + n * ln(2)
allows this sort of range reduction to be carried out directly from
the inspection of the binary "exponent" of floating point values.
If you wish, I'm sure that for a specific microprocessor, a Researcher
would be able to supply you with the details of what restricted range
instructions are implemented by those units.
On the other hand the phrasing of your Question seems to be open to a
broader interpretation, asking for more details of how such machine
instructions are themselve implemented "in a microprocessor". I
believe a great deal of information could be provided for you,
whichever area is the one your are interested in, but a better Answer
can be prepared if we know a bit more clearly what you would like.
regards, mathtalk-ga